├── .nuget ├── NuGet.exe └── NuGet.Config ├── SharedVersion.cs ├── OneDrive ├── thumb.png ├── Api │ ├── Link.cs │ ├── CreateLinkParameters.cs │ ├── LinkResult.cs │ ├── AuthorizationToken.cs │ ├── ViewChange.cs │ ├── CreateFolderParameters.cs │ ├── AuthorizationParameters.cs │ ├── UploadSession.cs │ ├── ILiveAuthenticationApi.cs │ ├── ViewChangesResult.cs │ ├── IOneDriveApi.cs │ └── LiveAuthenticationApi.cs ├── Dependencies │ ├── Newtonsoft.Json │ │ ├── Utilities │ │ │ ├── CollectionUtils.cs │ │ │ ├── MethodCall.cs │ │ │ ├── EnumValue.cs │ │ │ ├── StringReference.cs │ │ │ ├── ValidationUtils.cs │ │ │ ├── JsonTokenUtils.cs │ │ │ ├── ILGeneratorExtensions.cs │ │ │ ├── ThreadSafeStore.cs │ │ │ └── ReflectionDelegateFactory.cs │ │ ├── Linq │ │ │ ├── MergeArrayHandling.cs │ │ │ ├── JsonPath │ │ │ │ ├── QueryFilter.cs │ │ │ │ ├── ArrayMultipleIndexFilter.cs │ │ │ │ ├── ArrayIndexFilter.cs │ │ │ │ ├── FieldMultipleFilter.cs │ │ │ │ ├── FieldFilter.cs │ │ │ │ ├── PathFilter.cs │ │ │ │ ├── ScanFilter.cs │ │ │ │ └── ArraySliceFilter.cs │ │ │ ├── JsonMergeSettings.cs │ │ │ ├── IJEnumerable.cs │ │ │ ├── JTokenEqualityComparer.cs │ │ │ └── JRaw.cs │ │ ├── FormatterAssemblyStyle.cs │ │ ├── TraceLevel.cs │ │ ├── LICENSE.txt │ │ ├── Serialization │ │ │ ├── ITraceWriter.cs │ │ │ ├── ObjectConstructor.cs │ │ │ ├── OnErrorAttribute.cs │ │ │ ├── CachedAttributeGetter.cs │ │ │ ├── JsonLinqContract.cs │ │ │ ├── JsonStringContract.cs │ │ │ ├── IValueProvider.cs │ │ │ ├── JsonPrimitiveContract.cs │ │ │ ├── IContractResolver.cs │ │ │ ├── JsonISerializableContract.cs │ │ │ ├── CamelCasePropertyNamesContractResolver.cs │ │ │ ├── ErrorEventArgs.cs │ │ │ ├── IAttributeProvider.cs │ │ │ ├── ErrorContext.cs │ │ │ ├── DiagnosticsTraceWriter.cs │ │ │ ├── IReferenceResolver.cs │ │ │ ├── MemoryTraceWriter.cs │ │ │ ├── DefaultReferenceResolver.cs │ │ │ └── ReflectionAttributeProvider.cs │ │ ├── Schema │ │ │ ├── ValidationEventHandler.cs │ │ │ ├── JsonSchemaNodeCollection.cs │ │ │ ├── UndefinedSchemaIdHandling.cs │ │ │ ├── JsonSchemaType.cs │ │ │ ├── ValidationEventArgs.cs │ │ │ └── JsonSchemaResolver.cs │ │ ├── JsonExtensionDataAttribute.cs │ │ ├── JsonConverterCollection.cs │ │ ├── JsonConstructorAttribute.cs │ │ ├── SerializationBinder.cs │ │ ├── JsonIgnoreAttribute.cs │ │ ├── Bson │ │ │ ├── BsonBinaryType.cs │ │ │ ├── BsonType.cs │ │ │ └── BsonObjectId.cs │ │ ├── FloatParseHandling.cs │ │ ├── DateFormatHandling.cs │ │ ├── Formatting.cs │ │ ├── ObjectCreationHandling.cs │ │ ├── Required.cs │ │ ├── MissingMemberHandling.cs │ │ ├── StringEscapeHandling.cs │ │ ├── ConstructorHandling.cs │ │ ├── ReferenceLoopHandling.cs │ │ ├── MetadataPropertyHandling.cs │ │ ├── DateParseHandling.cs │ │ ├── JsonDictionaryAttribute.cs │ │ ├── NullValueHandling.cs │ │ ├── Converters │ │ │ └── DateTimeConverterBase.cs │ │ ├── IJsonLineInfo.cs │ │ ├── TypeNameHandling.cs │ │ ├── FloatFormatHandling.cs │ │ ├── DateTimeZoneHandling.cs │ │ ├── PreserveReferencesHandling.cs │ │ ├── WriteState.cs │ │ ├── MemberSerialization.cs │ │ ├── JsonArrayAttribute.cs │ │ └── DefaultValueHandling.cs │ └── DependencyModule.cs ├── packages.config ├── Configuration │ ├── GeneralConfiguration.cs │ ├── Token.cs │ ├── OneDriveSyncAccount.cs │ ├── IConfigurationRetriever.cs │ ├── PluginConfiguration.cs │ └── ConfigurationRetriever.cs ├── Constants.cs ├── RestServices │ ├── DeleteSyncTarget.cs │ ├── GetSyncTarget.cs │ ├── AddSyncTarget.cs │ └── OneDriveRestfulService.cs ├── BufferArray.cs ├── Properties │ └── AssemblyInfo.cs ├── Plugin.cs └── OneDriveCredentials.cs ├── Bookshelf ├── store_images │ └── mb-bookshelf-tile-redbook.jpg ├── Configuration │ ├── PluginConfiguration.cs │ └── configPage.html ├── packages.config ├── Providers │ ├── GoogleBooks │ │ ├── ApiUrls.cs │ │ └── ResponseObjects.cs │ └── ComicVine │ │ ├── ComicVineExternalIds.cs │ │ └── ResponseObjects.cs ├── Properties │ └── AssemblyInfo.cs └── Plugin.cs ├── MediaBrowser.Plugins.RottenTomatoes ├── packages.config ├── Configuration │ └── PluginConfiguration.cs ├── Providers │ └── RottenTomatoesId.cs ├── Properties │ └── AssemblyInfo.cs └── Plugin.cs ├── .gitattributes ├── README.md ├── MediaBrowser.Plugins.sln ├── MediaBrowser.Plugins.sln.GhostDoc.xml └── LICENSE.md /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MediaBrowser/Emby.Plugins/HEAD/.nuget/NuGet.exe -------------------------------------------------------------------------------- /SharedVersion.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyVersion("3.0.*")] 4 | -------------------------------------------------------------------------------- /OneDrive/thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MediaBrowser/Emby.Plugins/HEAD/OneDrive/thumb.png -------------------------------------------------------------------------------- /OneDrive/Api/Link.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive.Api 2 | { 3 | public class Link 4 | { 5 | public string webUrl { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Bookshelf/store_images/mb-bookshelf-tile-redbook.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MediaBrowser/Emby.Plugins/HEAD/Bookshelf/store_images/mb-bookshelf-tile-redbook.jpg -------------------------------------------------------------------------------- /OneDrive/Api/CreateLinkParameters.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive.Api 2 | { 3 | public class CreateLinkParameters 4 | { 5 | public string type { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/CollectionUtils.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MediaBrowser/Emby.Plugins/HEAD/OneDrive/Dependencies/Newtonsoft.Json/Utilities/CollectionUtils.cs -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /OneDrive/Api/LinkResult.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive.Api 2 | { 3 | public class LinkResult 4 | { 5 | public string id { get; set; } 6 | public Link link { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Bookshelf/Configuration/PluginConfiguration.cs: -------------------------------------------------------------------------------- 1 | using MediaBrowser.Model.Plugins; 2 | 3 | namespace MBBookshelf.Configuration 4 | { 5 | public class PluginConfiguration : BasePluginConfiguration 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /OneDrive/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Bookshelf/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /OneDrive/Configuration/GeneralConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive.Configuration 2 | { 3 | public class GeneralConfiguration 4 | { 5 | public string OneDriveClientId { get; set; } 6 | public string OneDriveClientSecret { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /MediaBrowser.Plugins.RottenTomatoes/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /OneDrive/Api/AuthorizationToken.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive.Api 2 | { 3 | public class AuthorizationToken 4 | { 5 | public int expires_in { get; set; } 6 | public string access_token { get; set; } 7 | public string refresh_token { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /OneDrive/Api/ViewChange.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive.Api 2 | { 3 | public class ViewChange 4 | { 5 | public string id { get; set; } 6 | public string name { get; set; } 7 | public object folder { get; set; } 8 | public object file { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /OneDrive/Configuration/Token.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDrive.Configuration 4 | { 5 | public class Token 6 | { 7 | public DateTime ExpiresAt { get; set; } 8 | public string AccessToken { get; set; } 9 | public string RefresToken { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OneDrive/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive 2 | { 3 | internal static class Constants 4 | { 5 | internal const string Name = "OneDrive"; 6 | internal const string Description = "Cloud sync provider for OneDrive"; 7 | internal const string OneDriveRedirectUrl = "https://login.live.com/oauth20_desktop.srf"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /MediaBrowser.Plugins.RottenTomatoes/Configuration/PluginConfiguration.cs: -------------------------------------------------------------------------------- 1 | using MediaBrowser.Model.Plugins; 2 | 3 | namespace MediaBrowser.Plugins.RottenTomatoes.Configuration 4 | { 5 | /// 6 | /// Class PluginConfiguration 7 | /// 8 | public class PluginConfiguration : BasePluginConfiguration 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OneDrive/Api/CreateFolderParameters.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace OneDrive.Api 4 | { 5 | public class CreateFolderParameters 6 | { 7 | public string name { get; set; } 8 | public object folder { get; set; } 9 | 10 | [JsonProperty("@name.conflictBehavior")] 11 | public string conflictBehavior { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /OneDrive/Api/AuthorizationParameters.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive.Api 2 | { 3 | public class AuthorizationParameters 4 | { 5 | public string client_id { get; set; } 6 | public string client_secret { get; set; } 7 | public string refresh_token { get; set; } 8 | public string grant_type { get; set; } 9 | public string code { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OneDrive/Api/UploadSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace OneDrive.Api 5 | { 6 | public class UploadSession 7 | { 8 | public string uploadUrl { get; set; } 9 | public DateTime expirationDateTime { get; set; } 10 | public List nextExpectedRanges { get; set; } 11 | public string id { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /OneDrive/RestServices/DeleteSyncTarget.cs: -------------------------------------------------------------------------------- 1 | using ServiceStack; 2 | 3 | namespace OneDrive.RestServices 4 | { 5 | [Route("/OneDrive/SyncTarget/{Id}", "DELETE")] 6 | public class DeleteSyncTarget : IReturnVoid 7 | { 8 | [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] 9 | public string Id { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OneDrive/RestServices/GetSyncTarget.cs: -------------------------------------------------------------------------------- 1 | using OneDrive.Configuration; 2 | using ServiceStack; 3 | 4 | namespace OneDrive.RestServices 5 | { 6 | [Route("/OneDrive/SyncTarget/{Id}", "GET")] 7 | public class GetSyncTarget : IReturn 8 | { 9 | [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] 10 | public string Id { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /OneDrive/RestServices/AddSyncTarget.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using ServiceStack; 3 | 4 | namespace OneDrive.RestServices 5 | { 6 | [Route("/OneDrive/SyncTarget", "POST")] 7 | public class AddSyncTarget : IReturnVoid 8 | { 9 | public string Id { get; set; } 10 | public string Name { get; set; } 11 | public bool EnableForEveryone { get; set; } 12 | public List UserIds { get; set; } 13 | public string Code { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /OneDrive/Api/ILiveAuthenticationApi.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace OneDrive.Api 5 | { 6 | public interface ILiveAuthenticationApi 7 | { 8 | Task AcquireToken(string code, string redirectUrl, string clientId, string clientSecret, CancellationToken cancellationToken); 9 | Task RefreshToken(string refreshToken, string redirectUrl, string clientId, string clientSecret, CancellationToken cancellationToken); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OneDrive/Api/ViewChangesResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | 4 | namespace OneDrive.Api 5 | { 6 | public class ViewChangesResult 7 | { 8 | public List value { get; set; } 9 | 10 | [JsonProperty("@odata.nextLink")] 11 | public string NextLink { get; set; } 12 | 13 | [JsonProperty("@changes.hasMoreChanges")] 14 | public bool HasMoreChanges { get; set; } 15 | 16 | [JsonProperty("@changes.token")] 17 | public string Token { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /OneDrive/Configuration/OneDriveSyncAccount.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OneDrive.Configuration 4 | { 5 | public class OneDriveSyncAccount 6 | { 7 | public OneDriveSyncAccount() 8 | { 9 | UserIds = new List(); 10 | } 11 | 12 | public string Id { get; set; } 13 | public string Name { get; set; } 14 | public Token AccessToken { get; set; } 15 | public bool EnableForEveryone { get; set; } 16 | public List UserIds { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain -------------------------------------------------------------------------------- /OneDrive/Configuration/IConfigurationRetriever.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OneDrive.Configuration 4 | { 5 | public interface IConfigurationRetriever 6 | { 7 | GeneralConfiguration GetGeneralConfiguration(); 8 | OneDriveSyncAccount GetSyncAccount(string id); 9 | IEnumerable GetSyncAccounts(); 10 | IEnumerable GetUserSyncAccounts(string userId); 11 | void AddSyncAccount(OneDriveSyncAccount syncAccount); 12 | void RemoveSyncAccount(string id); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /OneDrive/Configuration/PluginConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MediaBrowser.Model.Plugins; 3 | 4 | namespace OneDrive.Configuration 5 | { 6 | public class PluginConfiguration : BasePluginConfiguration 7 | { 8 | public PluginConfiguration() 9 | { 10 | SyncAccounts = new List(); 11 | } 12 | 13 | public string OneDriveClientId { get; set; } 14 | public string OneDriveClientSecret { get; set; } 15 | public List SyncAccounts { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/MergeArrayHandling.cs: -------------------------------------------------------------------------------- 1 | namespace Newtonsoft.Json.Linq 2 | { 3 | /// 4 | /// Specifies how JSON arrays are merged together. 5 | /// 6 | public enum MergeArrayHandling 7 | { 8 | /// Concatenate arrays. 9 | Concat = 0, 10 | 11 | /// Union arrays, skipping items that already exist. 12 | Union = 1, 13 | 14 | /// Replace all array items. 15 | Replace = 2, 16 | 17 | /// Merge array items together, matched by index. 18 | Merge = 3 19 | } 20 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Emby.Plugins 2 | ==================== 3 | 4 | This repository contains many of the plugins that are built and maintained by the Emby community. 5 | 6 | Each of the projects has a build event that copies it's output to the programdata/plugins folder. 7 | 8 | By default this assumes you have the server repository side by side in a folder called 'MediaBrowser'. If this is not the case, or if you've installed the server than you'll need to update the build events manually in order to test code changes. 9 | 10 | 11 | ## More Information ## 12 | 13 | [How to Build a Server Plugin](https://github.com/MediaBrowser/MediaBrowser/wiki/How-to-build-a-Server-Plugin) 14 | -------------------------------------------------------------------------------- /Bookshelf/Providers/GoogleBooks/ApiUrls.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MBBookshelf.Providers.GoogleBooks 8 | { 9 | public static class GoogleApiUrls 10 | { 11 | private const string ApiKey = "AIzaSyAs5if3sOZBf54gxCqc4OXqiQl9XPVnBJ8"; 12 | // GoogleBooks API Endpoints 13 | public const string SearchUrl = @"https://www.googleapis.com/books/v1/volumes?q={0}&startIndex={1}&maxResults={2}&key=" + ApiKey; 14 | public const string DetailsUrl = @"https://www.googleapis.com/books/v1/volumes/{0}?key=" + ApiKey; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonPath/QueryFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Newtonsoft.Json.Linq.JsonPath 5 | { 6 | internal class QueryFilter : PathFilter 7 | { 8 | public QueryExpression Expression { get; set; } 9 | 10 | public override IEnumerable ExecuteFilter(IEnumerable current, bool errorWhenNoMatch) 11 | { 12 | foreach (JToken t in current) 13 | { 14 | foreach (JToken v in t) 15 | { 16 | if (Expression.IsMatch(v)) 17 | yield return v; 18 | } 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /MediaBrowser.Plugins.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.3 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F17571BB-66D4-4DB5-8EC0-33A76DD5B018}" 7 | ProjectSection(SolutionItems) = preProject 8 | SharedVersion.cs = SharedVersion.cs 9 | EndProjectSection 10 | EndProject 11 | Global 12 | GlobalSection(SolutionProperties) = preSolution 13 | HideSolutionNode = FALSE 14 | EndGlobalSection 15 | GlobalSection(ExtensibilityGlobals) = postSolution 16 | SolutionGuid = {FF9BA2AD-B3EF-4AE1-9280-9EED3261A6FF} 17 | EndGlobalSection 18 | EndGlobal 19 | -------------------------------------------------------------------------------- /OneDrive/BufferArray.cs: -------------------------------------------------------------------------------- 1 | namespace OneDrive 2 | { 3 | internal class BufferArray 4 | { 5 | private readonly byte[] _buffer; 6 | 7 | public BufferArray() 8 | : this(new byte[0], 0) 9 | { } 10 | 11 | public BufferArray(byte[] buffer, int size) 12 | { 13 | _buffer = buffer; 14 | Count = size; 15 | } 16 | 17 | public int Count { get; private set; } 18 | 19 | public byte[] Array 20 | { 21 | get 22 | { 23 | var array = new byte[Count]; 24 | System.Array.Copy(_buffer, array, Count); 25 | return array; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonPath/ArrayMultipleIndexFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Newtonsoft.Json.Linq.JsonPath 4 | { 5 | internal class ArrayMultipleIndexFilter : PathFilter 6 | { 7 | public List Indexes { get; set; } 8 | 9 | public override IEnumerable ExecuteFilter(IEnumerable current, bool errorWhenNoMatch) 10 | { 11 | foreach (JToken t in current) 12 | { 13 | foreach (int i in Indexes) 14 | { 15 | JToken v = GetTokenIndex(t, errorWhenNoMatch, i); 16 | 17 | if (v != null) 18 | yield return v; 19 | } 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/DependencyModule.cs: -------------------------------------------------------------------------------- 1 | using MediaBrowser.Common; 2 | using MediaBrowser.Common.Plugins; 3 | using OneDrive.Api; 4 | using OneDrive.Configuration; 5 | 6 | namespace OneDrive.Dependencies 7 | { 8 | public class DependencyModule : IDependencyModule 9 | { 10 | public void BindDependencies(IDependencyContainer container) 11 | { 12 | Bind(container); 13 | Bind(container); 14 | Bind(container); 15 | } 16 | 17 | private void Bind(IDependencyContainer container) 18 | where TImplementation : TInterface 19 | { 20 | container.Register(typeof(TInterface), typeof(TImplementation)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Bookshelf/Configuration/configPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Emby Bookshelf 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Emby Bookshelf 14 | To setup Emby Bookshelf, just add a media library in Emby library setup and set the content type to Books. 15 | 16 | Supported E-Book Formats 17 | 18 | mobi 19 | epub 20 | pdf 21 | cbr 22 | cbz 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonMergeSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Newtonsoft.Json.Linq 4 | { 5 | /// 6 | /// Specifies the settings used when merging JSON. 7 | /// 8 | public class JsonMergeSettings 9 | { 10 | private MergeArrayHandling _mergeArrayHandling; 11 | 12 | /// 13 | /// Gets or sets the method used when merging JSON arrays. 14 | /// 15 | /// The method used when merging JSON arrays. 16 | public MergeArrayHandling MergeArrayHandling 17 | { 18 | get { return _mergeArrayHandling; } 19 | set 20 | { 21 | if (value < MergeArrayHandling.Concat || value > MergeArrayHandling.Merge) 22 | throw new ArgumentOutOfRangeException("value"); 23 | 24 | _mergeArrayHandling = value; 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/FormatterAssemblyStyle.cs: -------------------------------------------------------------------------------- 1 | 2 | #if PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE 3 | 4 | namespace System.Runtime.Serialization.Formatters 5 | { 6 | /// 7 | /// Indicates the method that will be used during deserialization for locating and loading assemblies. 8 | /// 9 | public enum FormatterAssemblyStyle 10 | { 11 | /// 12 | /// In simple mode, the assembly used during deserialization need not match exactly the assembly used during serialization. Specifically, the version numbers need not match as the LoadWithPartialName method is used to load the assembly. 13 | /// 14 | Simple = 0, 15 | 16 | /// 17 | /// In full mode, the assembly used during deserialization must match exactly the assembly used during serialization. The Load method of the Assembly class is used to load the assembly. 18 | /// 19 | Full = 1 20 | } 21 | } 22 | 23 | #endif -------------------------------------------------------------------------------- /MediaBrowser.Plugins.RottenTomatoes/Providers/RottenTomatoesId.cs: -------------------------------------------------------------------------------- 1 | using MediaBrowser.Controller.Entities; 2 | using MediaBrowser.Controller.Entities.Movies; 3 | using MediaBrowser.Controller.Providers; 4 | using MediaBrowser.Model.Entities; 5 | 6 | namespace MediaBrowser.Plugins.RottenTomatoes.Providers 7 | { 8 | public class RottenTomatoesExternalId : IExternalId 9 | { 10 | public string Name 11 | { 12 | get { return "Rotten Tomatoes"; } 13 | } 14 | 15 | public string Key 16 | { 17 | get { return KeyName; } 18 | } 19 | 20 | public string UrlFormatString 21 | { 22 | get { return null; } 23 | } 24 | 25 | public bool Supports(IHasProviderIds item) 26 | { 27 | return item is Movie || item is Trailer || item is MusicVideo; 28 | } 29 | 30 | public static string KeyName 31 | { 32 | get { return MetadataProviders.RottenTomatoes.ToString(); } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /OneDrive/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("OneDrive")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("OneDrive")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("a61e8033-9a7a-4e7d-a39f-d6c419dc4477")] 23 | -------------------------------------------------------------------------------- /Bookshelf/Providers/ComicVine/ComicVineExternalIds.cs: -------------------------------------------------------------------------------- 1 | using MediaBrowser.Controller.Entities; 2 | using MediaBrowser.Controller.Providers; 3 | using MediaBrowser.Model.Entities; 4 | 5 | namespace MBBookshelf.Providers.ComicVine 6 | { 7 | public class ComicVineVolumeExternalId : IExternalId 8 | { 9 | public string Key 10 | { 11 | get { return KeyName; } 12 | } 13 | 14 | public string Name 15 | { 16 | get { return "Comic Vine Volume"; } 17 | } 18 | 19 | public bool Supports(IHasProviderIds item) 20 | { 21 | return item is Book; 22 | } 23 | 24 | public string UrlFormatString 25 | { 26 | get 27 | { 28 | // TODO: Is there a url? 29 | return null; 30 | } 31 | } 32 | 33 | public static string KeyName 34 | { 35 | get 36 | { 37 | return "ComicVineVolume"; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/TraceLevel.cs: -------------------------------------------------------------------------------- 1 | 2 | #if (NETFX_CORE || PORTABLE40 || PORTABLE) 3 | using Newtonsoft.Json.Serialization; 4 | 5 | namespace Newtonsoft.Json 6 | { 7 | /// 8 | /// Specifies what messages to output for the class. 9 | /// 10 | public enum TraceLevel 11 | { 12 | /// 13 | /// Output no tracing and debugging messages. 14 | /// 15 | Off = 0, 16 | 17 | /// 18 | /// Output error-handling messages. 19 | /// 20 | Error = 1, 21 | 22 | /// 23 | /// Output warnings and error-handling messages. 24 | /// 25 | Warning = 2, 26 | 27 | /// 28 | /// Output informational messages, warnings, and error-handling messages. 29 | /// 30 | Info = 3, 31 | 32 | /// 33 | /// Output all debugging and tracing messages. 34 | /// 35 | Verbose = 4 36 | } 37 | } 38 | 39 | #endif -------------------------------------------------------------------------------- /MediaBrowser.Plugins.sln.GhostDoc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | D:\Development\MediaBrowser.Plugins\Help 13 | 14 | 15 | true 16 | false 17 | false 18 | false 19 | 20 | 21 | true 22 | false 23 | false 24 | false 25 | true 26 | false 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2007 James Newton-King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) Media Browser http://mediabrowser.tv 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /OneDrive/Api/IOneDriveApi.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace OneDrive.Api 5 | { 6 | public interface IOneDriveApi 7 | { 8 | Task CreateUploadSession(string path, OneDriveCredentials credentials, CancellationToken cancellationToken); 9 | Task UploadFragment(string url, long rangeStart, long rangeEnd, long totalLength, byte[] content, OneDriveCredentials credentials, CancellationToken cancellationToken); 10 | Task CreateFolder(string path, string name, OneDriveCredentials credentials, CancellationToken cancellationToken); 11 | Task Delete(string id, OneDriveCredentials credentials, CancellationToken cancellationToken); 12 | Task CreateLink(string id, OneDriveCredentials credentials, CancellationToken cancellationToken); 13 | Task ViewChangeById(string id, OneDriveCredentials credentials, CancellationToken cancellationToken); 14 | Task ViewChangeByPath(string path, OneDriveCredentials credentials, CancellationToken cancellationToken); 15 | Task ViewChanges(string token, OneDriveCredentials credentials, CancellationToken cancellationToken); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OneDrive/Plugin.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MediaBrowser.Common.Configuration; 3 | using MediaBrowser.Common.Plugins; 4 | using MediaBrowser.Model.Plugins; 5 | using MediaBrowser.Model.Serialization; 6 | using OneDrive.Configuration; 7 | 8 | namespace OneDrive 9 | { 10 | public class Plugin : BasePlugin, IHasWebPages 11 | { 12 | public static Plugin Instance { get; private set; } 13 | 14 | public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) 15 | : base(applicationPaths, xmlSerializer) 16 | { 17 | Instance = this; 18 | } 19 | 20 | public IEnumerable GetPages() 21 | { 22 | return new[] 23 | { 24 | new PluginPageInfo 25 | { 26 | Name = Name, 27 | EmbeddedResourcePath = GetType().Namespace + ".Configuration.configPage.html" 28 | } 29 | }; 30 | } 31 | 32 | public override string Name 33 | { 34 | get { return Constants.Name; } 35 | } 36 | 37 | public override string Description 38 | { 39 | get { return Constants.Description; } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/ITraceWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | 5 | namespace Newtonsoft.Json.Serialization 6 | { 7 | /// 8 | /// Represents a trace writer. 9 | /// 10 | public interface ITraceWriter 11 | { 12 | /// 13 | /// Gets the that will be used to filter the trace messages passed to the writer. 14 | /// For example a filter level of Info will exclude Verbose messages and include Info, 15 | /// Warning and Error messages. 16 | /// 17 | /// The that will be used to filter the trace messages passed to the writer. 18 | TraceLevel LevelFilter { get; } 19 | 20 | /// 21 | /// Writes the specified trace level, message and optional exception. 22 | /// 23 | /// The at which to write this trace. 24 | /// The trace message. 25 | /// The trace exception. This parameter is optional. 26 | void Trace(TraceLevel level, string message, Exception ex); 27 | } 28 | } -------------------------------------------------------------------------------- /MediaBrowser.Plugins.RottenTomatoes/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MediaBrowser.Plugins.RottenTomatoes")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MediaBrowser.Plugins.RottenTomatoes")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("99b9deee-2f49-418f-b3c3-b4390a7b3761")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/MethodCall.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Utilities 27 | { 28 | internal delegate TResult MethodCall(T target, params object[] args); 29 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonPath/ArrayIndexFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | using Newtonsoft.Json.Utilities; 4 | 5 | namespace Newtonsoft.Json.Linq.JsonPath 6 | { 7 | internal class ArrayIndexFilter : PathFilter 8 | { 9 | public int? Index { get; set; } 10 | 11 | public override IEnumerable ExecuteFilter(IEnumerable current, bool errorWhenNoMatch) 12 | { 13 | foreach (JToken t in current) 14 | { 15 | if (Index != null) 16 | { 17 | JToken v = GetTokenIndex(t, errorWhenNoMatch, Index.Value); 18 | 19 | if (v != null) 20 | yield return v; 21 | } 22 | else 23 | { 24 | if (t is JArray || t is JConstructor) 25 | { 26 | foreach (JToken v in t) 27 | { 28 | yield return v; 29 | } 30 | } 31 | else 32 | { 33 | if (errorWhenNoMatch) 34 | throw new JsonException("Index * not valid on {0}.".FormatWith(CultureInfo.InvariantCulture, t.GetType().Name)); 35 | } 36 | } 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Bookshelf/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MBBookshelf")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MBBookshelf")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("06d2760e-335c-4d33-a596-aba9e361b876")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | -------------------------------------------------------------------------------- /MediaBrowser.Plugins.RottenTomatoes/Plugin.cs: -------------------------------------------------------------------------------- 1 | using MediaBrowser.Common.Configuration; 2 | using MediaBrowser.Common.Plugins; 3 | using MediaBrowser.Model.Serialization; 4 | using MediaBrowser.Plugins.RottenTomatoes.Configuration; 5 | using System.Threading; 6 | 7 | namespace MediaBrowser.Plugins.RottenTomatoes 8 | { 9 | /// 10 | /// Class Plugin 11 | /// 12 | public class Plugin : BasePlugin 13 | { 14 | public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) 15 | : base(applicationPaths, xmlSerializer) 16 | { 17 | Instance = this; 18 | } 19 | 20 | /// 21 | /// Gets the name of the plugin 22 | /// 23 | /// The name. 24 | public override string Name 25 | { 26 | get { return "Rotten Tomatoes Reviews"; } 27 | } 28 | 29 | /// 30 | /// Gets the description. 31 | /// 32 | /// The description. 33 | public override string Description 34 | { 35 | get 36 | { 37 | return "Displays critic reviews from Rotten Tomatoes."; 38 | } 39 | } 40 | 41 | /// 42 | /// Gets the instance. 43 | /// 44 | /// The instance. 45 | public static Plugin Instance { get; private set; } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonPath/FieldMultipleFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | #if NET20 4 | using Newtonsoft.Json.Utilities.LinqBridge; 5 | #else 6 | using System.Linq; 7 | #endif 8 | using Newtonsoft.Json.Utilities; 9 | 10 | namespace Newtonsoft.Json.Linq.JsonPath 11 | { 12 | internal class FieldMultipleFilter : PathFilter 13 | { 14 | public List Names { get; set; } 15 | 16 | public override IEnumerable ExecuteFilter(IEnumerable current, bool errorWhenNoMatch) 17 | { 18 | foreach (JToken t in current) 19 | { 20 | JObject o = t as JObject; 21 | if (o != null) 22 | { 23 | foreach (string name in Names) 24 | { 25 | JToken v = o[name]; 26 | 27 | if (v != null) 28 | yield return v; 29 | 30 | if (errorWhenNoMatch) 31 | throw new JsonException("Property '{0}' does not exist on JObject.".FormatWith(CultureInfo.InvariantCulture, name)); 32 | } 33 | } 34 | else 35 | { 36 | if (errorWhenNoMatch) 37 | throw new JsonException("Properties {0} not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, string.Join(", ", Names.Select(n => "'" + n + "'").ToArray()), t.GetType().Name)); 38 | } 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/ObjectConstructor.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Serialization 27 | { 28 | /// 29 | /// Represents a method that constructs an object. 30 | /// 31 | /// The object type to create. 32 | public delegate object ObjectConstructor(params object[] args); 33 | } -------------------------------------------------------------------------------- /Bookshelf/Providers/GoogleBooks/ResponseObjects.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace MBBookshelf.Providers.GoogleBooks 4 | { 5 | public class SearchResult 6 | { 7 | public string kind { get; set; } 8 | public int totalItems { get; set; } 9 | public List items { get; set; } 10 | } 11 | 12 | public class BookResult 13 | { 14 | public string Kind { get; set; } 15 | public string id { get; set; } 16 | public string etag { get; set; } 17 | public string selfLink { get; set; } 18 | public VolumeInfo volumeInfo { get; set; } 19 | } 20 | 21 | public class VolumeInfo 22 | { 23 | public string title { get; set; } 24 | public List authors { get; set; } 25 | public string publishedDate { get; set; } 26 | public ImageLinks imageLinks { get; set; } 27 | public string publisher { get; set; } 28 | public string description { get; set; } 29 | public string mainCatagory { get; set; } 30 | public List catagories { get; set; } 31 | public float averageRating { get; set; } 32 | } 33 | 34 | public class ImageLinks 35 | { 36 | // Only the 2 thumbnail images are available during the initial search 37 | public string smallThumbnail { get; set; } 38 | public string thumbnail { get; set; } 39 | public string small { get; set; } 40 | public string medium { get; set; } 41 | public string large { get; set; } 42 | public string extraLarge { get; set; } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Schema/ValidationEventHandler.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Schema 27 | { 28 | /// 29 | /// Represents the callback method that will handle JSON schema validation events and the . 30 | /// 31 | public delegate void ValidationEventHandler(object sender, ValidationEventArgs e); 32 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/JsonExtensionDataAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Newtonsoft.Json 4 | { 5 | /// 6 | /// Instructs the to deserialize properties with no matching class member into the specified collection 7 | /// and write values during serialization. 8 | /// 9 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] 10 | public class JsonExtensionDataAttribute : Attribute 11 | { 12 | /// 13 | /// Gets or sets a value that indicates whether to write extension data when serializing the object. 14 | /// 15 | /// 16 | /// true to write extension data when serializing the object; otherwise, false. The default is true. 17 | /// 18 | public bool WriteData { get; set; } 19 | 20 | /// 21 | /// Gets or sets a value that indicates whether to read extension data when deserializing the object. 22 | /// 23 | /// 24 | /// true to read extension data when deserializing the object; otherwise, false. The default is true. 25 | /// 26 | public bool ReadData { get; set; } 27 | 28 | /// 29 | /// Initializes a new instance of the class. 30 | /// 31 | public JsonExtensionDataAttribute() 32 | { 33 | WriteData = true; 34 | ReadData = true; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Schema/JsonSchemaNodeCollection.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System.Collections.ObjectModel; 27 | 28 | namespace Newtonsoft.Json.Schema 29 | { 30 | internal class JsonSchemaNodeCollection : KeyedCollection 31 | { 32 | protected override string GetKeyForItem(JsonSchemaNode item) 33 | { 34 | return item.Id; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/JsonConverterCollection.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Text; 29 | using System.Collections.ObjectModel; 30 | 31 | namespace Newtonsoft.Json 32 | { 33 | /// 34 | /// Represents a collection of . 35 | /// 36 | public class JsonConverterCollection : Collection 37 | { 38 | } 39 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonPath/FieldFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | using Newtonsoft.Json.Utilities; 4 | 5 | namespace Newtonsoft.Json.Linq.JsonPath 6 | { 7 | internal class FieldFilter : PathFilter 8 | { 9 | public string Name { get; set; } 10 | 11 | public override IEnumerable ExecuteFilter(IEnumerable current, bool errorWhenNoMatch) 12 | { 13 | foreach (JToken t in current) 14 | { 15 | JObject o = t as JObject; 16 | if (o != null) 17 | { 18 | if (Name != null) 19 | { 20 | JToken v = o[Name]; 21 | 22 | if (v != null) 23 | yield return v; 24 | else if (errorWhenNoMatch) 25 | throw new JsonException("Property '{0}' does not exist on JObject.".FormatWith(CultureInfo.InvariantCulture, Name)); 26 | } 27 | else 28 | { 29 | foreach (KeyValuePair p in o) 30 | { 31 | yield return p.Value; 32 | } 33 | } 34 | } 35 | else 36 | { 37 | if (errorWhenNoMatch) 38 | throw new JsonException("Property '{0}' not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, Name ?? "*", t.GetType().Name)); 39 | } 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/JsonConstructorAttribute.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json 29 | { 30 | /// 31 | /// Instructs the to use the specified constructor when deserializing that object. 32 | /// 33 | [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false)] 34 | public sealed class JsonConstructorAttribute : Attribute 35 | { 36 | } 37 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/OnErrorAttribute.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Serialization 29 | { 30 | /// 31 | /// When applied to a method, specifies that the method is called when an error occurs serializing an object. 32 | /// 33 | [AttributeUsage(AttributeTargets.Method, Inherited = false)] 34 | public sealed class OnErrorAttribute : Attribute 35 | { 36 | } 37 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/SerializationBinder.cs: -------------------------------------------------------------------------------- 1 | 2 | #if PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE 3 | using System; 4 | using System.Reflection; 5 | 6 | namespace Newtonsoft.Json 7 | { 8 | /// 9 | /// Allows users to control class loading and mandate what class to load. 10 | /// 11 | public abstract class SerializationBinder 12 | { 13 | /// 14 | /// When overridden in a derived class, controls the binding of a serialized object to a type. 15 | /// 16 | /// Specifies the name of the serialized object. 17 | /// Specifies the name of the serialized object 18 | /// The type of the object the formatter creates a new instance of. 19 | public abstract Type BindToType(string assemblyName, string typeName); 20 | 21 | /// 22 | /// When overridden in a derived class, controls the binding of a serialized object to a type. 23 | /// 24 | /// The type of the object the formatter creates a new instance of. 25 | /// Specifies the name of the serialized object. 26 | /// Specifies the name of the serialized object. 27 | public virtual void BindToName(Type serializedType, out string assemblyName, out string typeName) 28 | { 29 | assemblyName = null; 30 | typeName = null; 31 | } 32 | } 33 | } 34 | 35 | #endif -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/JsonIgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Text; 29 | 30 | namespace Newtonsoft.Json 31 | { 32 | /// 33 | /// Instructs the not to serialize the public field or public read/write property value. 34 | /// 35 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] 36 | public sealed class JsonIgnoreAttribute : Attribute 37 | { 38 | } 39 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonPath/PathFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | using Newtonsoft.Json.Utilities; 4 | 5 | namespace Newtonsoft.Json.Linq.JsonPath 6 | { 7 | internal abstract class PathFilter 8 | { 9 | public abstract IEnumerable ExecuteFilter(IEnumerable current, bool errorWhenNoMatch); 10 | 11 | protected static JToken GetTokenIndex(JToken t, bool errorWhenNoMatch, int index) 12 | { 13 | JArray a = t as JArray; 14 | JConstructor c = t as JConstructor; 15 | 16 | if (a != null) 17 | { 18 | if (a.Count <= index) 19 | { 20 | if (errorWhenNoMatch) 21 | throw new JsonException("Index {0} outside the bounds of JArray.".FormatWith(CultureInfo.InvariantCulture, index)); 22 | 23 | return null; 24 | } 25 | 26 | return a[index]; 27 | } 28 | else if (c != null) 29 | { 30 | if (c.Count <= index) 31 | { 32 | if (errorWhenNoMatch) 33 | throw new JsonException("Index {0} outside the bounds of JConstructor.".FormatWith(CultureInfo.InvariantCulture, index)); 34 | 35 | return null; 36 | } 37 | 38 | return c[index]; 39 | } 40 | else 41 | { 42 | if (errorWhenNoMatch) 43 | throw new JsonException("Index {0} not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, index, t.GetType().Name)); 44 | 45 | return null; 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Bson/BsonBinaryType.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Bson 29 | { 30 | internal enum BsonBinaryType : byte 31 | { 32 | Binary = 0x00, 33 | Function = 0x01, 34 | 35 | [Obsolete("This type has been deprecated in the BSON specification. Use Binary instead.")] 36 | BinaryOld = 0x02, 37 | 38 | [Obsolete("This type has been deprecated in the BSON specification. Use Uuid instead.")] 39 | UuidOld = 0x03, 40 | Uuid = 0x04, 41 | Md5 = 0x05, 42 | UserDefined = 0x80 43 | } 44 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/CachedAttributeGetter.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Reflection; 28 | using Newtonsoft.Json.Utilities; 29 | 30 | namespace Newtonsoft.Json.Serialization 31 | { 32 | internal static class CachedAttributeGetter where T : Attribute 33 | { 34 | private static readonly ThreadSafeStore TypeAttributeCache = new ThreadSafeStore(JsonTypeReflector.GetAttribute); 35 | 36 | public static T GetAttribute(object type) 37 | { 38 | return TypeAttributeCache.Get(type); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/FloatParseHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text. 30 | /// 31 | public enum FloatParseHandling 32 | { 33 | /// 34 | /// Floating point numbers are parsed to . 35 | /// 36 | Double = 0, 37 | 38 | /// 39 | /// Floating point numbers are parsed to . 40 | /// 41 | Decimal = 1 42 | } 43 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/EnumValue.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Utilities 27 | { 28 | internal class EnumValue where T : struct 29 | { 30 | private readonly string _name; 31 | private readonly T _value; 32 | 33 | public string Name 34 | { 35 | get { return _name; } 36 | } 37 | 38 | public T Value 39 | { 40 | get { return _value; } 41 | } 42 | 43 | public EnumValue(string name, T value) 44 | { 45 | _name = name; 46 | _value = value; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/DateFormatHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies how dates are formatted when writing JSON text. 30 | /// 31 | public enum DateFormatHandling 32 | { 33 | /// 34 | /// Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z". 35 | /// 36 | IsoDateFormat, 37 | 38 | /// 39 | /// Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/". 40 | /// 41 | MicrosoftDateFormat 42 | } 43 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonPath/ScanFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Newtonsoft.Json.Linq.JsonPath 4 | { 5 | internal class ScanFilter : PathFilter 6 | { 7 | public string Name { get; set; } 8 | 9 | public override IEnumerable ExecuteFilter(IEnumerable current, bool errorWhenNoMatch) 10 | { 11 | foreach (JToken root in current) 12 | { 13 | if (Name == null) 14 | yield return root; 15 | 16 | JToken value = root; 17 | JToken container = root; 18 | 19 | while (true) 20 | { 21 | if (container != null && container.HasValues) 22 | { 23 | value = container.First; 24 | } 25 | else 26 | { 27 | while (value != null && value != root && value == value.Parent.Last) 28 | { 29 | value = value.Parent; 30 | } 31 | 32 | if (value == null || value == root) 33 | break; 34 | 35 | value = value.Next; 36 | } 37 | 38 | JProperty e = value as JProperty; 39 | if (e != null) 40 | { 41 | if (e.Name == Name) 42 | yield return e.Value; 43 | } 44 | else 45 | { 46 | if (Name == null) 47 | yield return value; 48 | } 49 | 50 | container = value as JContainer; 51 | } 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Bson/BsonType.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Bson 27 | { 28 | internal enum BsonType : sbyte 29 | { 30 | Number = 1, 31 | String = 2, 32 | Object = 3, 33 | Array = 4, 34 | Binary = 5, 35 | Undefined = 6, 36 | Oid = 7, 37 | Boolean = 8, 38 | Date = 9, 39 | Null = 10, 40 | Regex = 11, 41 | Reference = 12, 42 | Code = 13, 43 | Symbol = 14, 44 | CodeWScope = 15, 45 | Integer = 16, 46 | TimeStamp = 17, 47 | Long = 18, 48 | MinKey = -1, 49 | MaxKey = 127 50 | } 51 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Formatting.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies formatting options for the . 30 | /// 31 | public enum Formatting 32 | { 33 | /// 34 | /// No special formatting is applied. This is the default. 35 | /// 36 | None = 0, 37 | 38 | /// 39 | /// Causes child objects to be indented according to the and settings. 40 | /// 41 | Indented = 1 42 | } 43 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/ObjectCreationHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies how object creation is handled by the . 30 | /// 31 | public enum ObjectCreationHandling 32 | { 33 | /// 34 | /// Reuse existing objects, create new objects when needed. 35 | /// 36 | Auto = 0, 37 | 38 | /// 39 | /// Only reuse existing objects. 40 | /// 41 | Reuse = 1, 42 | 43 | /// 44 | /// Always create new objects. 45 | /// 46 | Replace = 2 47 | } 48 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Required.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Indicating whether a property is required. 30 | /// 31 | public enum Required 32 | { 33 | /// 34 | /// The property is not required. The default state. 35 | /// 36 | Default = 0, 37 | 38 | /// 39 | /// The property must be defined in JSON but can be a null value. 40 | /// 41 | AllowNull = 1, 42 | 43 | /// 44 | /// The property must be defined in JSON and cannot be a null value. 45 | /// 46 | Always = 2 47 | } 48 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/IJEnumerable.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System.Collections.Generic; 27 | 28 | namespace Newtonsoft.Json.Linq 29 | { 30 | /// 31 | /// Represents a collection of objects. 32 | /// 33 | /// The type of token 34 | public interface IJEnumerable< 35 | #if !(NET20 || NET35) 36 | out 37 | #endif 38 | T> : IEnumerable where T : JToken 39 | { 40 | /// 41 | /// Gets the with the specified key. 42 | /// 43 | /// 44 | IJEnumerable this[object key] { get; } 45 | } 46 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/MissingMemberHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Text; 29 | 30 | namespace Newtonsoft.Json 31 | { 32 | /// 33 | /// Specifies missing member handling options for the . 34 | /// 35 | public enum MissingMemberHandling 36 | { 37 | /// 38 | /// Ignore a missing member and do not attempt to deserialize it. 39 | /// 40 | Ignore = 0, 41 | 42 | /// 43 | /// Throw a when a missing member is encountered during deserialization. 44 | /// 45 | Error = 1 46 | } 47 | } -------------------------------------------------------------------------------- /OneDrive/Configuration/ConfigurationRetriever.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace OneDrive.Configuration 5 | { 6 | public class ConfigurationRetriever : IConfigurationRetriever 7 | { 8 | private static PluginConfiguration Configuration 9 | { 10 | get { return Plugin.Instance.Configuration; } 11 | } 12 | 13 | public GeneralConfiguration GetGeneralConfiguration() 14 | { 15 | return new GeneralConfiguration 16 | { 17 | OneDriveClientId = Configuration.OneDriveClientId, 18 | OneDriveClientSecret = Configuration.OneDriveClientSecret 19 | }; 20 | } 21 | 22 | public OneDriveSyncAccount GetSyncAccount(string id) 23 | { 24 | return Configuration.SyncAccounts.FirstOrDefault(acc => acc.Id == id); 25 | } 26 | 27 | public IEnumerable GetSyncAccounts() 28 | { 29 | return Configuration.SyncAccounts; 30 | } 31 | 32 | public IEnumerable GetUserSyncAccounts(string userId) 33 | { 34 | return Configuration.SyncAccounts.Where(acc => acc.EnableForEveryone || acc.UserIds.Contains(userId)); 35 | } 36 | 37 | public void AddSyncAccount(OneDriveSyncAccount syncAccount) 38 | { 39 | RemoveSyncAccount(syncAccount.Id); 40 | 41 | Configuration.SyncAccounts.Add(syncAccount); 42 | 43 | Plugin.Instance.SaveConfiguration(); 44 | } 45 | 46 | public void RemoveSyncAccount(string id) 47 | { 48 | var existingAccountIndex = Configuration.SyncAccounts.FindIndex(acc => acc.Id == id); 49 | 50 | if (existingAccountIndex != -1) 51 | { 52 | Configuration.SyncAccounts.RemoveAt(existingAccountIndex); 53 | } 54 | 55 | Plugin.Instance.SaveConfiguration(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Schema/UndefinedSchemaIdHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Schema 27 | { 28 | /// 29 | /// Specifies undefined schema Id handling options for the . 30 | /// 31 | public enum UndefinedSchemaIdHandling 32 | { 33 | /// 34 | /// Do not infer a schema Id. 35 | /// 36 | None = 0, 37 | 38 | /// 39 | /// Use the .NET type name as the schema Id. 40 | /// 41 | UseTypeName = 1, 42 | 43 | /// 44 | /// Use the assembly qualified .NET type name as the schema Id. 45 | /// 46 | UseAssemblyQualifiedName = 2, 47 | } 48 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/JsonLinqContract.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Serialization 29 | { 30 | /// 31 | /// Contract details for a used by the . 32 | /// 33 | public class JsonLinqContract : JsonContract 34 | { 35 | /// 36 | /// Initializes a new instance of the class. 37 | /// 38 | /// The underlying type for the contract. 39 | public JsonLinqContract(Type underlyingType) 40 | : base(underlyingType) 41 | { 42 | ContractType = JsonContractType.Linq; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Bookshelf/Plugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using MBBookshelf.Configuration; 8 | using MediaBrowser.Common.Configuration; 9 | using MediaBrowser.Common.Plugins; 10 | using MediaBrowser.Model.Plugins; 11 | using MediaBrowser.Model.Serialization; 12 | 13 | namespace MBBookshelf 14 | { 15 | public class Plugin : BasePlugin, IHasWebPages 16 | { 17 | public readonly SemaphoreSlim GoogleBooksSemiphore = new SemaphoreSlim(5, 5); 18 | public readonly SemaphoreSlim ComicVineSemiphore = new SemaphoreSlim(5, 5); 19 | 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) 26 | : base(applicationPaths, xmlSerializer) 27 | { 28 | Instance = this; 29 | } 30 | 31 | /// 32 | /// 33 | /// 34 | public override string Name 35 | { 36 | get { return "MB Bookshelf"; } 37 | } 38 | 39 | public IEnumerable GetPages() 40 | { 41 | return new[] 42 | { 43 | new PluginPageInfo 44 | { 45 | Name = Name, 46 | EmbeddedResourcePath = GetType().Namespace + ".Configuration.configPage.html" 47 | } 48 | }; 49 | } 50 | 51 | /// 52 | /// 53 | /// 54 | public static Plugin Instance { get; private set; } 55 | 56 | /// 57 | /// 58 | /// 59 | public PluginConfiguration PluginConfiguration 60 | { 61 | get { return Configuration; } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/JsonStringContract.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Serialization 29 | { 30 | /// 31 | /// Contract details for a used by the . 32 | /// 33 | public class JsonStringContract : JsonPrimitiveContract 34 | { 35 | /// 36 | /// Initializes a new instance of the class. 37 | /// 38 | /// The underlying type for the contract. 39 | public JsonStringContract(Type underlyingType) 40 | : base(underlyingType) 41 | { 42 | ContractType = JsonContractType.String; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/StringEscapeHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies how strings are escaped when writing JSON text. 30 | /// 31 | public enum StringEscapeHandling 32 | { 33 | /// 34 | /// Only control characters (e.g. newline) are escaped. 35 | /// 36 | Default = 0, 37 | 38 | /// 39 | /// All non-ASCII and control characters (e.g. newline) are escaped. 40 | /// 41 | EscapeNonAscii = 1, 42 | 43 | /// 44 | /// HTML (<, >, &, ', ") and control characters (e.g. newline) are escaped. 45 | /// 46 | EscapeHtml = 2 47 | } 48 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/ConstructorHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies how constructors are used when initializing objects during deserialization by the . 30 | /// 31 | public enum ConstructorHandling 32 | { 33 | /// 34 | /// First attempt to use the public default constructor, then fall back to single paramatized constructor, then the non-public default constructor. 35 | /// 36 | Default = 0, 37 | 38 | /// 39 | /// Json.NET will use a non-public default constructor before falling back to a paramatized constructor. 40 | /// 41 | AllowNonPublicDefaultConstructor = 1 42 | } 43 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/ReferenceLoopHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Text; 29 | 30 | namespace Newtonsoft.Json 31 | { 32 | /// 33 | /// Specifies reference loop handling options for the . 34 | /// 35 | public enum ReferenceLoopHandling 36 | { 37 | /// 38 | /// Throw a when a loop is encountered. 39 | /// 40 | Error = 0, 41 | 42 | /// 43 | /// Ignore loop references and do not serialize. 44 | /// 45 | Ignore = 1, 46 | 47 | /// 48 | /// Serialize loop references. 49 | /// 50 | Serialize = 2 51 | } 52 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/IValueProvider.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Serialization 27 | { 28 | /// 29 | /// Provides methods to get and set values. 30 | /// 31 | public interface IValueProvider 32 | { 33 | /// 34 | /// Sets the value. 35 | /// 36 | /// The target to set the value on. 37 | /// The value to set on the target. 38 | void SetValue(object target, object value); 39 | 40 | /// 41 | /// Gets the value. 42 | /// 43 | /// The target to get the value from. 44 | /// The value. 45 | object GetValue(object target); 46 | } 47 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/MetadataPropertyHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Text; 29 | 30 | namespace Newtonsoft.Json 31 | { 32 | /// 33 | /// Specifies metadata property handling options for the . 34 | /// 35 | public enum MetadataPropertyHandling 36 | { 37 | /// 38 | /// Read metadata properties located at the start of a JSON object. 39 | /// 40 | Default = 0, 41 | 42 | /// 43 | /// Read metadata properties located anywhere in a JSON object. Note that this setting will impact performance. 44 | /// 45 | ReadAhead = 1, 46 | 47 | /// 48 | /// Do not try to read metadata properties. 49 | /// 50 | Ignore = 2 51 | } 52 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/DateParseHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON text. 30 | /// 31 | public enum DateParseHandling 32 | { 33 | /// 34 | /// Date formatted strings are not parsed to a date type and are read as strings. 35 | /// 36 | None = 0, 37 | 38 | /// 39 | /// Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed to . 40 | /// 41 | DateTime = 1, 42 | #if !NET20 43 | /// 44 | /// Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed to . 45 | /// 46 | DateTimeOffset = 2 47 | #endif 48 | } 49 | } -------------------------------------------------------------------------------- /Bookshelf/Providers/ComicVine/ResponseObjects.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MBBookshelf.Providers.ComicVine 8 | { 9 | public class SearchResult 10 | { 11 | public string error { get; set; } 12 | public int limit { get; set; } 13 | public int offset { get; set; } 14 | public int number_of_page_results { get; set; } 15 | public int number_of_total_results { get; set; } 16 | public int status_code { get; set; } 17 | public List results { get; set; } 18 | public string version { get; set; } 19 | } 20 | 21 | public class Result 22 | { 23 | public string aliases { get; set; } 24 | public string api_detail_url { get; set; } 25 | public string cover_date { get; set; } 26 | public string date_added { get; set; } 27 | public string date_last_updated { get; set; } 28 | public string deck { get; set; } 29 | public string description { get; set; } 30 | public bool has_staff_review { get; set; } 31 | public int id { get; set; } 32 | public ImageUrls image { get; set; } 33 | public string issue_number { get; set; } 34 | public string name { get; set; } 35 | public string site_detail_url { get; set; } 36 | public string store_date { get; set; } 37 | public Volume volume { get; set; } 38 | public string resource_type { get; set; } 39 | } 40 | 41 | public class ImageUrls 42 | { 43 | public string icon_url { get; set; } 44 | public string medium_url { get; set; } 45 | public string screen_url { get; set; } 46 | public string small_url { get; set; } 47 | public string super_url { get; set; } 48 | public string thumb_url { get; set; } 49 | public string tiny_url { get; set; } 50 | } 51 | 52 | public class Volume 53 | { 54 | public string api_detail_url { get; set; } 55 | public int id { get; set; } 56 | public string name { get; set; } 57 | public string site_detail_url { get; set; } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/StringReference.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Utilities 27 | { 28 | internal struct StringReference 29 | { 30 | private readonly char[] _chars; 31 | private readonly int _startIndex; 32 | private readonly int _length; 33 | 34 | public char[] Chars 35 | { 36 | get { return _chars; } 37 | } 38 | 39 | public int StartIndex 40 | { 41 | get { return _startIndex; } 42 | } 43 | 44 | public int Length 45 | { 46 | get { return _length; } 47 | } 48 | 49 | public StringReference(char[] chars, int startIndex, int length) 50 | { 51 | _chars = chars; 52 | _startIndex = startIndex; 53 | _length = length; 54 | } 55 | 56 | public override string ToString() 57 | { 58 | return new string(_chars, _startIndex, _length); 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/JsonPrimitiveContract.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using Newtonsoft.Json.Utilities; 28 | 29 | namespace Newtonsoft.Json.Serialization 30 | { 31 | /// 32 | /// Contract details for a used by the . 33 | /// 34 | public class JsonPrimitiveContract : JsonContract 35 | { 36 | internal PrimitiveTypeCode TypeCode { get; set; } 37 | 38 | /// 39 | /// Initializes a new instance of the class. 40 | /// 41 | /// The underlying type for the contract. 42 | public JsonPrimitiveContract(Type underlyingType) 43 | : base(underlyingType) 44 | { 45 | ContractType = JsonContractType.Primitive; 46 | 47 | TypeCode = ConvertUtils.GetTypeCode(underlyingType); 48 | IsReadOnlyOrFixedSize = true; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Bson/BsonObjectId.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using Newtonsoft.Json.Utilities; 28 | 29 | namespace Newtonsoft.Json.Bson 30 | { 31 | /// 32 | /// Represents a BSON Oid (object id). 33 | /// 34 | public class BsonObjectId 35 | { 36 | /// 37 | /// Gets or sets the value of the Oid. 38 | /// 39 | /// The value of the Oid. 40 | public byte[] Value { get; private set; } 41 | 42 | /// 43 | /// Initializes a new instance of the class. 44 | /// 45 | /// The Oid value. 46 | public BsonObjectId(byte[] value) 47 | { 48 | ValidationUtils.ArgumentNotNull(value, "value"); 49 | if (value.Length != 12) 50 | throw new ArgumentException("An ObjectId must be 12 bytes", "value"); 51 | 52 | Value = value; 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/JsonDictionaryAttribute.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json 29 | { 30 | /// 31 | /// Instructs the how to serialize the collection. 32 | /// 33 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] 34 | public sealed class JsonDictionaryAttribute : JsonContainerAttribute 35 | { 36 | /// 37 | /// Initializes a new instance of the class. 38 | /// 39 | public JsonDictionaryAttribute() 40 | { 41 | } 42 | 43 | /// 44 | /// Initializes a new instance of the class with the specified container Id. 45 | /// 46 | /// The container Id. 47 | public JsonDictionaryAttribute(string id) 48 | : base(id) 49 | { 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/NullValueHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies null value handling options for the . 30 | /// 31 | /// 32 | /// 33 | /// 34 | /// 35 | public enum NullValueHandling 36 | { 37 | /// 38 | /// Include null values when serializing and deserializing objects. 39 | /// 40 | Include = 0, 41 | 42 | /// 43 | /// Ignore null values when serializing and deserializing objects. 44 | /// 45 | Ignore = 1 46 | } 47 | } -------------------------------------------------------------------------------- /OneDrive/Api/LiveAuthenticationApi.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using MediaBrowser.Common; 5 | using MediaBrowser.Common.Net; 6 | using MediaBrowser.Model.Serialization; 7 | 8 | namespace OneDrive.Api 9 | { 10 | public class LiveAuthenticationApi : ApiService, ILiveAuthenticationApi 11 | { 12 | protected override string BaseUrl 13 | { 14 | get { return "https://login.live.com/"; } 15 | } 16 | 17 | public LiveAuthenticationApi(IHttpClient httpClient, IJsonSerializer jsonSerializer, IApplicationHost applicationHost) 18 | : base(httpClient, jsonSerializer, applicationHost) 19 | { } 20 | 21 | public Task AcquireToken(string code, string redirectUrl, string clientId, string clientSecret, CancellationToken cancellationToken) 22 | { 23 | var data = new Dictionary 24 | { 25 | { "client_id", clientId }, 26 | { "client_secret", clientSecret }, 27 | { "code", code }, 28 | { "grant_type", "authorization_code" }, 29 | { "redirect_uri", redirectUrl } 30 | }; 31 | 32 | var httpRequest = PrepareHttpRequestOptions("oauth20_token.srf", null, cancellationToken); 33 | httpRequest.SetPostData(data); 34 | 35 | return PostRequest(httpRequest, cancellationToken); 36 | } 37 | 38 | public Task RefreshToken(string refreshToken, string redirectUrl, string clientId, string clientSecret, CancellationToken cancellationToken) 39 | { 40 | var data = new Dictionary 41 | { 42 | { "client_id", clientId }, 43 | { "client_secret", clientSecret }, 44 | { "refresh_token", refreshToken }, 45 | { "grant_type", "refresh_token" }, 46 | { "redirect_uri", redirectUrl } 47 | }; 48 | 49 | var httpRequest = PrepareHttpRequestOptions("oauth20_token.srf", null, cancellationToken); 50 | httpRequest.SetPostData(data); 51 | 52 | return PostRequest(httpRequest, cancellationToken); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/IContractResolver.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Serialization 29 | { 30 | /// 31 | /// Used by to resolves a for a given . 32 | /// 33 | /// 34 | /// 35 | /// 36 | /// 37 | public interface IContractResolver 38 | { 39 | /// 40 | /// Resolves the contract for a given type. 41 | /// 42 | /// The type to resolve a contract for. 43 | /// The contract for a given type. 44 | JsonContract ResolveContract(Type type); 45 | } 46 | } -------------------------------------------------------------------------------- /OneDrive/OneDriveCredentials.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using MediaBrowser.Model.Sync; 5 | using OneDrive.Api; 6 | using OneDrive.Configuration; 7 | 8 | namespace OneDrive 9 | { 10 | public class OneDriveCredentials 11 | { 12 | private readonly IConfigurationRetriever _configurationRetriever; 13 | private readonly ILiveAuthenticationApi _liveAuthenticationApi; 14 | private readonly string _syncAccountId; 15 | private readonly Token _accessToken; 16 | 17 | public OneDriveCredentials(IConfigurationRetriever configurationRetriever, ILiveAuthenticationApi liveAuthenticationApi, SyncTarget target) 18 | { 19 | _configurationRetriever = configurationRetriever; 20 | _liveAuthenticationApi = liveAuthenticationApi; 21 | _syncAccountId = target.Id; 22 | 23 | var syncAccount = configurationRetriever.GetSyncAccount(target.Id); 24 | _accessToken = syncAccount.AccessToken; 25 | } 26 | 27 | public async Task GetAccessToken(CancellationToken cancellationToken) 28 | { 29 | // Give a buffer around the expiration time 30 | if (_accessToken.ExpiresAt <= DateTime.UtcNow.AddSeconds(-20)) 31 | { 32 | await RefreshToken(cancellationToken); 33 | } 34 | 35 | return _accessToken.AccessToken; 36 | } 37 | 38 | private async Task RefreshToken(CancellationToken cancellationToken) 39 | { 40 | var config = _configurationRetriever.GetGeneralConfiguration(); 41 | var now = DateTime.UtcNow; 42 | var refreshToken = await _liveAuthenticationApi.RefreshToken(_accessToken.RefresToken, Constants.OneDriveRedirectUrl, config.OneDriveClientId, config.OneDriveClientSecret, cancellationToken); 43 | 44 | _accessToken.AccessToken = refreshToken.access_token; 45 | _accessToken.ExpiresAt = now.AddSeconds(refreshToken.expires_in); 46 | _accessToken.RefresToken = refreshToken.refresh_token; 47 | 48 | var syncAccount = _configurationRetriever.GetSyncAccount(_syncAccountId); 49 | syncAccount.AccessToken = _accessToken; 50 | 51 | _configurationRetriever.AddSyncAccount(syncAccount); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Converters/DateTimeConverterBase.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Converters 29 | { 30 | /// 31 | /// Provides a base class for converting a to and from JSON. 32 | /// 33 | public abstract class DateTimeConverterBase : JsonConverter 34 | { 35 | /// 36 | /// Determines whether this instance can convert the specified object type. 37 | /// 38 | /// Type of the object. 39 | /// 40 | /// true if this instance can convert the specified object type; otherwise, false. 41 | /// 42 | public override bool CanConvert(Type objectType) 43 | { 44 | if (objectType == typeof(DateTime) || objectType == typeof(DateTime?)) 45 | return true; 46 | #if !NET20 47 | if (objectType == typeof(DateTimeOffset) || objectType == typeof(DateTimeOffset?)) 48 | return true; 49 | #endif 50 | 51 | return false; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/IJsonLineInfo.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Provides an interface to enable a class to return line and position information. 30 | /// 31 | public interface IJsonLineInfo 32 | { 33 | /// 34 | /// Gets a value indicating whether the class can return line information. 35 | /// 36 | /// 37 | /// true if LineNumber and LinePosition can be provided; otherwise, false. 38 | /// 39 | bool HasLineInfo(); 40 | 41 | /// 42 | /// Gets the current line number. 43 | /// 44 | /// The current line number or 0 if no line information is available (for example, HasLineInfo returns false). 45 | int LineNumber { get; } 46 | 47 | /// 48 | /// Gets the current line position. 49 | /// 50 | /// The current line position or 0 if no line information is available (for example, HasLineInfo returns false). 51 | int LinePosition { get; } 52 | } 53 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/TypeNameHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json 29 | { 30 | /// 31 | /// Specifies type name handling options for the . 32 | /// 33 | [Flags] 34 | public enum TypeNameHandling 35 | { 36 | /// 37 | /// Do not include the .NET type name when serializing types. 38 | /// 39 | None = 0, 40 | 41 | /// 42 | /// Include the .NET type name when serializing into a JSON object structure. 43 | /// 44 | Objects = 1, 45 | 46 | /// 47 | /// Include the .NET type name when serializing into a JSON array structure. 48 | /// 49 | Arrays = 2, 50 | 51 | /// 52 | /// Always include the .NET type name when serializing. 53 | /// 54 | All = Objects | Arrays, 55 | 56 | /// 57 | /// Include the .NET type name when the type of the object being serialized is not the same as its declared type. 58 | /// 59 | Auto = 4 60 | } 61 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/JsonISerializableContract.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | #if !(NETFX_CORE || PORTABLE || PORTABLE40) 27 | using System; 28 | using System.Runtime.Serialization; 29 | 30 | namespace Newtonsoft.Json.Serialization 31 | { 32 | /// 33 | /// Contract details for a used by the . 34 | /// 35 | public class JsonISerializableContract : JsonContainerContract 36 | { 37 | /// 38 | /// Gets or sets the ISerializable object constructor. 39 | /// 40 | /// The ISerializable object constructor. 41 | public ObjectConstructor ISerializableCreator { get; set; } 42 | 43 | /// 44 | /// Initializes a new instance of the class. 45 | /// 46 | /// The underlying type for the contract. 47 | public JsonISerializableContract(Type underlyingType) 48 | : base(underlyingType) 49 | { 50 | ContractType = JsonContractType.Serializable; 51 | } 52 | } 53 | } 54 | #endif -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/FloatFormatHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json 27 | { 28 | /// 29 | /// Specifies float format handling options when writing special floating point numbers, e.g. , 30 | /// and with . 31 | /// 32 | public enum FloatFormatHandling 33 | { 34 | /// 35 | /// Write special floating point values as strings in JSON, e.g. "NaN", "Infinity", "-Infinity". 36 | /// 37 | String = 0, 38 | 39 | /// 40 | /// Write special floating point values as symbols in JSON, e.g. NaN, Infinity, -Infinity. 41 | /// Note that this will produce non-valid JSON. 42 | /// 43 | Symbol = 1, 44 | 45 | /// 46 | /// Write special floating point values as the property's default value in JSON, e.g. 0.0 for a property, null for a property. 47 | /// 48 | DefaultValue = 2 49 | } 50 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/CamelCasePropertyNamesContractResolver.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System.Globalization; 27 | using Newtonsoft.Json.Utilities; 28 | 29 | namespace Newtonsoft.Json.Serialization 30 | { 31 | /// 32 | /// Resolves member mappings for a type, camel casing property names. 33 | /// 34 | public class CamelCasePropertyNamesContractResolver : DefaultContractResolver 35 | { 36 | /// 37 | /// Initializes a new instance of the class. 38 | /// 39 | public CamelCasePropertyNamesContractResolver() 40 | : base(true) 41 | { 42 | } 43 | 44 | /// 45 | /// Resolves the name of the property. 46 | /// 47 | /// Name of the property. 48 | /// The property name camel cased. 49 | protected internal override string ResolvePropertyName(string propertyName) 50 | { 51 | // lower case the first letter of the passed in name 52 | return StringUtils.ToCamelCase(propertyName); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/DateTimeZoneHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json 29 | { 30 | /// 31 | /// Specifies how to treat the time value when converting between string and . 32 | /// 33 | public enum DateTimeZoneHandling 34 | { 35 | /// 36 | /// Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time. 37 | /// 38 | Local = 0, 39 | 40 | /// 41 | /// Treat as a UTC. If the object represents a local time, it is converted to a UTC. 42 | /// 43 | Utc = 1, 44 | 45 | /// 46 | /// Treat as a local time if a is being converted to a string. 47 | /// If a string is being converted to , convert to a local time if a time zone is specified. 48 | /// 49 | Unspecified = 2, 50 | 51 | /// 52 | /// Time zone information should be preserved when converting. 53 | /// 54 | RoundtripKind = 3 55 | } 56 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/ErrorEventArgs.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Serialization 29 | { 30 | /// 31 | /// Provides data for the Error event. 32 | /// 33 | public class ErrorEventArgs : EventArgs 34 | { 35 | /// 36 | /// Gets the current object the error event is being raised against. 37 | /// 38 | /// The current object the error event is being raised against. 39 | public object CurrentObject { get; private set; } 40 | 41 | /// 42 | /// Gets the error context. 43 | /// 44 | /// The error context. 45 | public ErrorContext ErrorContext { get; private set; } 46 | 47 | /// 48 | /// Initializes a new instance of the class. 49 | /// 50 | /// The current object. 51 | /// The error context. 52 | public ErrorEventArgs(object currentObject, ErrorContext errorContext) 53 | { 54 | CurrentObject = currentObject; 55 | ErrorContext = errorContext; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/ValidationUtils.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections; 28 | using System.Collections.Generic; 29 | using System.Text; 30 | using System.Globalization; 31 | 32 | namespace Newtonsoft.Json.Utilities 33 | { 34 | internal static class ValidationUtils 35 | { 36 | public static void ArgumentNotNullOrEmpty(string value, string parameterName) 37 | { 38 | if (value == null) 39 | throw new ArgumentNullException(parameterName); 40 | 41 | if (value.Length == 0) 42 | throw new ArgumentException("'{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName), parameterName); 43 | } 44 | 45 | public static void ArgumentTypeIsEnum(Type enumType, string parameterName) 46 | { 47 | ArgumentNotNull(enumType, "enumType"); 48 | 49 | if (!enumType.IsEnum()) 50 | throw new ArgumentException("Type {0} is not an Enum.".FormatWith(CultureInfo.InvariantCulture, enumType), parameterName); 51 | } 52 | 53 | public static void ArgumentNotNull(object value, string parameterName) 54 | { 55 | if (value == null) 56 | throw new ArgumentNullException(parameterName); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/IAttributeProvider.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | 29 | namespace Newtonsoft.Json.Serialization 30 | { 31 | /// 32 | /// Provides methods to get attributes. 33 | /// 34 | public interface IAttributeProvider 35 | { 36 | /// 37 | /// Returns a collection of all of the attributes, or an empty collection if there are no attributes. 38 | /// 39 | /// When true, look up the hierarchy chain for the inherited custom attribute. 40 | /// A collection of s, or an empty collection. 41 | IList GetAttributes(bool inherit); 42 | 43 | /// 44 | /// Returns a collection of attributes, identified by type, or an empty collection if there are no attributes. 45 | /// 46 | /// The type of the attributes. 47 | /// When true, look up the hierarchy chain for the inherited custom attribute. 48 | /// A collection of s, or an empty collection. 49 | IList GetAttributes(Type attributeType, bool inherit); 50 | } 51 | } -------------------------------------------------------------------------------- /OneDrive/RestServices/OneDriveRestfulService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using MediaBrowser.Controller.Net; 6 | using OneDrive.Api; 7 | using OneDrive.Configuration; 8 | 9 | namespace OneDrive.RestServices 10 | { 11 | [Authenticated] 12 | public class OneDriveRestfulService : IRestfulService 13 | { 14 | private readonly IConfigurationRetriever _configurationRetriever; 15 | private readonly ILiveAuthenticationApi _liveAuthenticationApi; 16 | 17 | public OneDriveRestfulService(IConfigurationRetriever configurationRetriever, ILiveAuthenticationApi liveAuthenticationApi) 18 | { 19 | _configurationRetriever = configurationRetriever; 20 | _liveAuthenticationApi = liveAuthenticationApi; 21 | } 22 | 23 | public void Delete(DeleteSyncTarget request) 24 | { 25 | _configurationRetriever.RemoveSyncAccount(request.Id); 26 | } 27 | 28 | public async Task Post(AddSyncTarget request) 29 | { 30 | var accessToken = await GetAccessToken(request.Code); 31 | 32 | var syncAccount = new OneDriveSyncAccount 33 | { 34 | Id = Guid.NewGuid().ToString(), 35 | Name = WebUtility.UrlDecode(request.Name), 36 | EnableForEveryone = request.EnableForEveryone, 37 | UserIds = request.UserIds, 38 | AccessToken = accessToken 39 | }; 40 | 41 | if (!string.IsNullOrEmpty(request.Id)) 42 | { 43 | syncAccount.Id = request.Id; 44 | } 45 | 46 | _configurationRetriever.AddSyncAccount(syncAccount); 47 | } 48 | 49 | public OneDriveSyncAccount Get(GetSyncTarget request) 50 | { 51 | return _configurationRetriever.GetSyncAccount(request.Id); 52 | } 53 | 54 | private async Task GetAccessToken(string code) 55 | { 56 | var config = _configurationRetriever.GetGeneralConfiguration(); 57 | 58 | var now = DateTime.UtcNow; 59 | var token = await _liveAuthenticationApi.AcquireToken(code, Constants.OneDriveRedirectUrl, config.OneDriveClientId, config.OneDriveClientSecret, CancellationToken.None); 60 | 61 | return new Token 62 | { 63 | AccessToken = token.access_token, 64 | ExpiresAt = now.AddSeconds(token.expires_in), 65 | RefresToken = token.refresh_token 66 | }; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Schema/JsonSchemaType.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Schema 29 | { 30 | /// 31 | /// The value types allowed by the . 32 | /// 33 | [Flags] 34 | public enum JsonSchemaType 35 | { 36 | /// 37 | /// No type specified. 38 | /// 39 | None = 0, 40 | 41 | /// 42 | /// String type. 43 | /// 44 | String = 1, 45 | 46 | /// 47 | /// Float type. 48 | /// 49 | Float = 2, 50 | 51 | /// 52 | /// Integer type. 53 | /// 54 | Integer = 4, 55 | 56 | /// 57 | /// Boolean type. 58 | /// 59 | Boolean = 8, 60 | 61 | /// 62 | /// Object type. 63 | /// 64 | Object = 16, 65 | 66 | /// 67 | /// Array type. 68 | /// 69 | Array = 32, 70 | 71 | /// 72 | /// Null type. 73 | /// 74 | Null = 64, 75 | 76 | /// 77 | /// Any type. 78 | /// 79 | Any = String | Float | Integer | Boolean | Object | Array | Null 80 | } 81 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/PreserveReferencesHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Text; 29 | 30 | namespace Newtonsoft.Json 31 | { 32 | /// 33 | /// Specifies reference handling options for the . 34 | /// Note that references cannot be preserved when a value is set via a non-default constructor such as types that implement ISerializable. 35 | /// 36 | /// 37 | /// 38 | /// 39 | [Flags] 40 | public enum PreserveReferencesHandling 41 | { 42 | /// 43 | /// Do not preserve references when serializing types. 44 | /// 45 | None = 0, 46 | 47 | /// 48 | /// Preserve references when serializing into a JSON object structure. 49 | /// 50 | Objects = 1, 51 | 52 | /// 53 | /// Preserve references when serializing into a JSON array structure. 54 | /// 55 | Arrays = 2, 56 | 57 | /// 58 | /// Preserve references when serializing. 59 | /// 60 | All = Objects | Arrays 61 | } 62 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/WriteState.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json 29 | { 30 | /// 31 | /// Specifies the state of the . 32 | /// 33 | public enum WriteState 34 | { 35 | /// 36 | /// An exception has been thrown, which has left the in an invalid state. 37 | /// You may call the method to put the in the Closed state. 38 | /// Any other method calls results in an being thrown. 39 | /// 40 | Error = 0, 41 | 42 | /// 43 | /// The method has been called. 44 | /// 45 | Closed = 1, 46 | 47 | /// 48 | /// An object is being written. 49 | /// 50 | Object = 2, 51 | 52 | /// 53 | /// A array is being written. 54 | /// 55 | Array = 3, 56 | 57 | /// 58 | /// A constructor is being written. 59 | /// 60 | Constructor = 4, 61 | 62 | /// 63 | /// A property is being written. 64 | /// 65 | Property = 5, 66 | 67 | /// 68 | /// A write method has not been called. 69 | /// 70 | Start = 6 71 | } 72 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JTokenEqualityComparer.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System.Collections.Generic; 27 | 28 | namespace Newtonsoft.Json.Linq 29 | { 30 | /// 31 | /// Compares tokens to determine whether they are equal. 32 | /// 33 | public class JTokenEqualityComparer : IEqualityComparer 34 | { 35 | /// 36 | /// Determines whether the specified objects are equal. 37 | /// 38 | /// The first object of type to compare. 39 | /// The second object of type to compare. 40 | /// 41 | /// true if the specified objects are equal; otherwise, false. 42 | /// 43 | public bool Equals(JToken x, JToken y) 44 | { 45 | return JToken.DeepEquals(x, y); 46 | } 47 | 48 | /// 49 | /// Returns a hash code for the specified object. 50 | /// 51 | /// The for which a hash code is to be returned. 52 | /// A hash code for the specified object. 53 | /// The type of is a reference type and is null. 54 | public int GetHashCode(JToken obj) 55 | { 56 | if (obj == null) 57 | return 0; 58 | 59 | return obj.GetDeepHashCode(); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Schema/ValidationEventArgs.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using Newtonsoft.Json.Utilities; 28 | 29 | namespace Newtonsoft.Json.Schema 30 | { 31 | /// 32 | /// Returns detailed information related to the . 33 | /// 34 | public class ValidationEventArgs : EventArgs 35 | { 36 | private readonly JsonSchemaException _ex; 37 | 38 | internal ValidationEventArgs(JsonSchemaException ex) 39 | { 40 | ValidationUtils.ArgumentNotNull(ex, "ex"); 41 | _ex = ex; 42 | } 43 | 44 | /// 45 | /// Gets the associated with the validation error. 46 | /// 47 | /// The JsonSchemaException associated with the validation error. 48 | public JsonSchemaException Exception 49 | { 50 | get { return _ex; } 51 | } 52 | 53 | /// 54 | /// Gets the path of the JSON location where the validation error occurred. 55 | /// 56 | /// The path of the JSON location where the validation error occurred. 57 | public string Path 58 | { 59 | get { return _ex.Path; } 60 | } 61 | 62 | /// 63 | /// Gets the text description corresponding to the validation error. 64 | /// 65 | /// The text description. 66 | public string Message 67 | { 68 | get { return _ex.Message; } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/MemberSerialization.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Runtime.Serialization; 28 | using Newtonsoft.Json.Serialization; 29 | 30 | namespace Newtonsoft.Json 31 | { 32 | /// 33 | /// Specifies the member serialization options for the . 34 | /// 35 | public enum MemberSerialization 36 | { 37 | #pragma warning disable 1584,1711,1572,1581,1580,1574 38 | /// 39 | /// All public members are serialized by default. Members can be excluded using or . 40 | /// This is the default member serialization mode. 41 | /// 42 | OptOut = 0, 43 | 44 | /// 45 | /// Only members must be marked with or are serialized. 46 | /// This member serialization mode can also be set by marking the class with . 47 | /// 48 | OptIn = 1, 49 | 50 | /// 51 | /// All public and private fields are serialized. Members can be excluded using or . 52 | /// This member serialization mode can also be set by marking the class with 53 | /// and setting IgnoreSerializableAttribute on to false. 54 | /// 55 | Fields = 2 56 | #pragma warning restore 1584,1711,1572,1581,1580,1574 57 | } 58 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Schema/JsonSchemaResolver.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | #if NET20 29 | using Newtonsoft.Json.Utilities.LinqBridge; 30 | #else 31 | using System.Linq; 32 | 33 | #endif 34 | 35 | namespace Newtonsoft.Json.Schema 36 | { 37 | /// 38 | /// Resolves from an id. 39 | /// 40 | public class JsonSchemaResolver 41 | { 42 | /// 43 | /// Gets or sets the loaded schemas. 44 | /// 45 | /// The loaded schemas. 46 | public IList LoadedSchemas { get; protected set; } 47 | 48 | /// 49 | /// Initializes a new instance of the class. 50 | /// 51 | public JsonSchemaResolver() 52 | { 53 | LoadedSchemas = new List(); 54 | } 55 | 56 | /// 57 | /// Gets a for the specified reference. 58 | /// 59 | /// The id. 60 | /// A for the specified reference. 61 | public virtual JsonSchema GetSchema(string reference) 62 | { 63 | JsonSchema schema = LoadedSchemas.SingleOrDefault(s => string.Equals(s.Id, reference, StringComparison.Ordinal)); 64 | 65 | if (schema == null) 66 | schema = LoadedSchemas.SingleOrDefault(s => string.Equals(s.Location, reference, StringComparison.Ordinal)); 67 | 68 | return schema; 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/JsonTokenUtils.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Text; 28 | 29 | namespace Newtonsoft.Json.Utilities 30 | { 31 | internal static class JsonTokenUtils 32 | { 33 | internal static bool IsEndToken(JsonToken token) 34 | { 35 | switch (token) 36 | { 37 | case JsonToken.EndObject: 38 | case JsonToken.EndArray: 39 | case JsonToken.EndConstructor: 40 | return true; 41 | default: 42 | return false; 43 | } 44 | } 45 | 46 | internal static bool IsStartToken(JsonToken token) 47 | { 48 | switch (token) 49 | { 50 | case JsonToken.StartObject: 51 | case JsonToken.StartArray: 52 | case JsonToken.StartConstructor: 53 | return true; 54 | default: 55 | return false; 56 | } 57 | } 58 | 59 | internal static bool IsPrimitiveToken(JsonToken token) 60 | { 61 | switch (token) 62 | { 63 | case JsonToken.Integer: 64 | case JsonToken.Float: 65 | case JsonToken.String: 66 | case JsonToken.Boolean: 67 | case JsonToken.Undefined: 68 | case JsonToken.Null: 69 | case JsonToken.Date: 70 | case JsonToken.Bytes: 71 | return true; 72 | default: 73 | return false; 74 | } 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JRaw.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System.Globalization; 27 | using System.IO; 28 | 29 | namespace Newtonsoft.Json.Linq 30 | { 31 | /// 32 | /// Represents a raw JSON string. 33 | /// 34 | public class JRaw : JValue 35 | { 36 | /// 37 | /// Initializes a new instance of the class from another object. 38 | /// 39 | /// A object to copy from. 40 | public JRaw(JRaw other) 41 | : base(other) 42 | { 43 | } 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | /// The raw json. 49 | public JRaw(object rawJson) 50 | : base(rawJson, JTokenType.Raw) 51 | { 52 | } 53 | 54 | /// 55 | /// Creates an instance of with the content of the reader's current token. 56 | /// 57 | /// The reader. 58 | /// An instance of with the content of the reader's current token. 59 | public static JRaw Create(JsonReader reader) 60 | { 61 | using (StringWriter sw = new StringWriter(CultureInfo.InvariantCulture)) 62 | using (JsonTextWriter jsonWriter = new JsonTextWriter(sw)) 63 | { 64 | jsonWriter.WriteToken(reader); 65 | 66 | return new JRaw(sw.ToString()); 67 | } 68 | } 69 | 70 | internal override JToken CloneToken() 71 | { 72 | return new JRaw(this); 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/ErrorContext.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json.Serialization 29 | { 30 | /// 31 | /// Provides information surrounding an error. 32 | /// 33 | public class ErrorContext 34 | { 35 | internal ErrorContext(object originalObject, object member, string path, Exception error) 36 | { 37 | OriginalObject = originalObject; 38 | Member = member; 39 | Error = error; 40 | Path = path; 41 | } 42 | 43 | internal bool Traced { get; set; } 44 | 45 | /// 46 | /// Gets the error. 47 | /// 48 | /// The error. 49 | public Exception Error { get; private set; } 50 | 51 | /// 52 | /// Gets the original object that caused the error. 53 | /// 54 | /// The original object that caused the error. 55 | public object OriginalObject { get; private set; } 56 | 57 | /// 58 | /// Gets the member that caused the error. 59 | /// 60 | /// The member that caused the error. 61 | public object Member { get; private set; } 62 | 63 | /// 64 | /// Gets the path of the JSON location where the error occurred. 65 | /// 66 | /// The path of the JSON location where the error occurred. 67 | public string Path { get; private set; } 68 | 69 | /// 70 | /// Gets or sets a value indicating whether this is handled. 71 | /// 72 | /// true if handled; otherwise, false. 73 | public bool Handled { get; set; } 74 | } 75 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/JsonArrayAttribute.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | 28 | namespace Newtonsoft.Json 29 | { 30 | /// 31 | /// Instructs the how to serialize the collection. 32 | /// 33 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] 34 | public sealed class JsonArrayAttribute : JsonContainerAttribute 35 | { 36 | private bool _allowNullItems; 37 | 38 | /// 39 | /// Gets or sets a value indicating whether null items are allowed in the collection. 40 | /// 41 | /// true if null items are allowed in the collection; otherwise, false. 42 | public bool AllowNullItems 43 | { 44 | get { return _allowNullItems; } 45 | set { _allowNullItems = value; } 46 | } 47 | 48 | /// 49 | /// Initializes a new instance of the class. 50 | /// 51 | public JsonArrayAttribute() 52 | { 53 | } 54 | 55 | /// 56 | /// Initializes a new instance of the class with a flag indicating whether the array can contain null items 57 | /// 58 | /// A flag indicating whether the array can contain null items. 59 | public JsonArrayAttribute(bool allowNullItems) 60 | { 61 | _allowNullItems = allowNullItems; 62 | } 63 | 64 | /// 65 | /// Initializes a new instance of the class with the specified container Id. 66 | /// 67 | /// The container Id. 68 | public JsonArrayAttribute(string id) 69 | : base(id) 70 | { 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/DiagnosticsTraceWriter.cs: -------------------------------------------------------------------------------- 1 | #if !(PORTABLE40 || PORTABLE || NETFX_CORE) 2 | using System; 3 | using System.Diagnostics; 4 | using DiagnosticsTrace = System.Diagnostics.Trace; 5 | 6 | namespace Newtonsoft.Json.Serialization 7 | { 8 | /// 9 | /// Represents a trace writer that writes to the application's instances. 10 | /// 11 | public class DiagnosticsTraceWriter : ITraceWriter 12 | { 13 | /// 14 | /// Gets the that will be used to filter the trace messages passed to the writer. 15 | /// For example a filter level of Info will exclude Verbose messages and include Info, 16 | /// Warning and Error messages. 17 | /// 18 | /// 19 | /// The that will be used to filter the trace messages passed to the writer. 20 | /// 21 | public TraceLevel LevelFilter { get; set; } 22 | 23 | private TraceEventType GetTraceEventType(TraceLevel level) 24 | { 25 | switch (level) 26 | { 27 | case TraceLevel.Error: 28 | return TraceEventType.Error; 29 | case TraceLevel.Warning: 30 | return TraceEventType.Warning; 31 | case TraceLevel.Info: 32 | return TraceEventType.Information; 33 | case TraceLevel.Verbose: 34 | return TraceEventType.Verbose; 35 | default: 36 | throw new ArgumentOutOfRangeException("level"); 37 | } 38 | } 39 | 40 | /// 41 | /// Writes the specified trace level, message and optional exception. 42 | /// 43 | /// The at which to write this trace. 44 | /// The trace message. 45 | /// The trace exception. This parameter is optional. 46 | public void Trace(TraceLevel level, string message, Exception ex) 47 | { 48 | if (level == TraceLevel.Off) 49 | return; 50 | 51 | TraceEventCache eventCache = new TraceEventCache(); 52 | TraceEventType traceEventType = GetTraceEventType(level); 53 | 54 | foreach (TraceListener listener in DiagnosticsTrace.Listeners) 55 | { 56 | if (!listener.IsThreadSafe) 57 | { 58 | lock (listener) 59 | { 60 | listener.TraceEvent(eventCache, "Newtonsoft.Json", traceEventType, 0, message); 61 | } 62 | } 63 | else 64 | { 65 | listener.TraceEvent(eventCache, "Newtonsoft.Json", traceEventType, 0, message); 66 | } 67 | 68 | if (DiagnosticsTrace.AutoFlush) 69 | listener.Flush(); 70 | } 71 | } 72 | } 73 | } 74 | 75 | #endif -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/IReferenceResolver.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | namespace Newtonsoft.Json.Serialization 27 | { 28 | /// 29 | /// Used to resolve references when serializing and deserializing JSON by the . 30 | /// 31 | public interface IReferenceResolver 32 | { 33 | /// 34 | /// Resolves a reference to its object. 35 | /// 36 | /// The serialization context. 37 | /// The reference to resolve. 38 | /// The object that 39 | object ResolveReference(object context, string reference); 40 | 41 | /// 42 | /// Gets the reference for the sepecified object. 43 | /// 44 | /// The serialization context. 45 | /// The object to get a reference for. 46 | /// The reference to the object. 47 | string GetReference(object context, object value); 48 | 49 | /// 50 | /// Determines whether the specified object is referenced. 51 | /// 52 | /// The serialization context. 53 | /// The object to test for a reference. 54 | /// 55 | /// true if the specified object is referenced; otherwise, false. 56 | /// 57 | bool IsReferenced(object context, object value); 58 | 59 | /// 60 | /// Adds a reference to the specified object. 61 | /// 62 | /// The serialization context. 63 | /// The reference. 64 | /// The object to reference. 65 | void AddReference(object context, string reference, object value); 66 | } 67 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Linq/JsonPath/ArraySliceFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using Newtonsoft.Json.Utilities; 5 | 6 | namespace Newtonsoft.Json.Linq.JsonPath 7 | { 8 | internal class ArraySliceFilter : PathFilter 9 | { 10 | public int? Start { get; set; } 11 | public int? End { get; set; } 12 | public int? Step { get; set; } 13 | 14 | public override IEnumerable ExecuteFilter(IEnumerable current, bool errorWhenNoMatch) 15 | { 16 | if (Step == 0) 17 | throw new JsonException("Step cannot be zero."); 18 | 19 | foreach (JToken t in current) 20 | { 21 | JArray a = t as JArray; 22 | if (a != null) 23 | { 24 | // set defaults for null arguments 25 | int stepCount = Step ?? 1; 26 | int startIndex = Start ?? ((stepCount > 0) ? 0 : a.Count - 1); 27 | int stopIndex = End ?? ((stepCount > 0) ? a.Count : -1); 28 | 29 | // start from the end of the list if start is negitive 30 | if (Start < 0) startIndex = a.Count + startIndex; 31 | 32 | // end from the start of the list if stop is negitive 33 | if (End < 0) stopIndex = a.Count + stopIndex; 34 | 35 | // ensure indexes keep within collection bounds 36 | startIndex = Math.Max(startIndex, (stepCount > 0) ? 0 : int.MinValue); 37 | startIndex = Math.Min(startIndex, (stepCount > 0) ? a.Count : a.Count - 1); 38 | stopIndex = Math.Max(stopIndex, -1); 39 | stopIndex = Math.Min(stopIndex, a.Count); 40 | 41 | bool positiveStep = (stepCount > 0); 42 | 43 | if (IsValid(startIndex, stopIndex, positiveStep)) 44 | { 45 | for (int i = startIndex; IsValid(i, stopIndex, positiveStep); i += stepCount) 46 | { 47 | yield return a[i]; 48 | } 49 | } 50 | else 51 | { 52 | if (errorWhenNoMatch) 53 | throw new JsonException("Array slice of {0} to {1} returned no results.".FormatWith(CultureInfo.InvariantCulture, 54 | Start != null ? Start.Value.ToString(CultureInfo.InvariantCulture) : "*", 55 | End != null ? End.Value.ToString(CultureInfo.InvariantCulture) : "*")); 56 | } 57 | } 58 | else 59 | { 60 | if (errorWhenNoMatch) 61 | throw new JsonException("Array slice is not valid on {0}.".FormatWith(CultureInfo.InvariantCulture, t.GetType().Name)); 62 | } 63 | } 64 | } 65 | 66 | private bool IsValid(int index, int stopIndex, bool positiveStep) 67 | { 68 | if (positiveStep) 69 | return (index < stopIndex); 70 | 71 | return (index > stopIndex); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | #if !(PORTABLE40 || PORTABLE || NETFX_CORE) 27 | using System; 28 | using System.Reflection.Emit; 29 | using System.Reflection; 30 | 31 | namespace Newtonsoft.Json.Utilities 32 | { 33 | internal static class ILGeneratorExtensions 34 | { 35 | public static void PushInstance(this ILGenerator generator, Type type) 36 | { 37 | generator.Emit(OpCodes.Ldarg_0); 38 | if (type.IsValueType()) 39 | generator.Emit(OpCodes.Unbox, type); 40 | else 41 | generator.Emit(OpCodes.Castclass, type); 42 | } 43 | 44 | public static void PushArrayInstance(this ILGenerator generator, int argsIndex, int arrayIndex) 45 | { 46 | generator.Emit(OpCodes.Ldarg, argsIndex); 47 | generator.Emit(OpCodes.Ldc_I4, arrayIndex); 48 | generator.Emit(OpCodes.Ldelem_Ref); 49 | } 50 | 51 | public static void BoxIfNeeded(this ILGenerator generator, Type type) 52 | { 53 | if (type.IsValueType()) 54 | generator.Emit(OpCodes.Box, type); 55 | else 56 | generator.Emit(OpCodes.Castclass, type); 57 | } 58 | 59 | public static void UnboxIfNeeded(this ILGenerator generator, Type type) 60 | { 61 | if (type.IsValueType()) 62 | generator.Emit(OpCodes.Unbox_Any, type); 63 | else 64 | generator.Emit(OpCodes.Castclass, type); 65 | } 66 | 67 | public static void CallMethod(this ILGenerator generator, MethodInfo methodInfo) 68 | { 69 | if (methodInfo.IsFinal || !methodInfo.IsVirtual) 70 | generator.Emit(OpCodes.Call, methodInfo); 71 | else 72 | generator.Emit(OpCodes.Callvirt, methodInfo); 73 | } 74 | 75 | public static void Return(this ILGenerator generator) 76 | { 77 | generator.Emit(OpCodes.Ret); 78 | } 79 | } 80 | } 81 | #endif -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/ThreadSafeStore.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | #if NET20 29 | using Newtonsoft.Json.Utilities.LinqBridge; 30 | #endif 31 | using System.Threading; 32 | using Newtonsoft.Json.Serialization; 33 | 34 | namespace Newtonsoft.Json.Utilities 35 | { 36 | internal class ThreadSafeStore 37 | { 38 | private readonly object _lock = new object(); 39 | private Dictionary _store; 40 | private readonly Func _creator; 41 | 42 | public ThreadSafeStore(Func creator) 43 | { 44 | if (creator == null) 45 | throw new ArgumentNullException("creator"); 46 | 47 | _creator = creator; 48 | _store = new Dictionary(); 49 | } 50 | 51 | public TValue Get(TKey key) 52 | { 53 | TValue value; 54 | if (!_store.TryGetValue(key, out value)) 55 | return AddValue(key); 56 | 57 | return value; 58 | } 59 | 60 | private TValue AddValue(TKey key) 61 | { 62 | TValue value = _creator(key); 63 | 64 | lock (_lock) 65 | { 66 | if (_store == null) 67 | { 68 | _store = new Dictionary(); 69 | _store[key] = value; 70 | } 71 | else 72 | { 73 | // double check locking 74 | TValue checkValue; 75 | if (_store.TryGetValue(key, out checkValue)) 76 | return checkValue; 77 | 78 | Dictionary newStore = new Dictionary(_store); 79 | newStore[key] = value; 80 | 81 | #if !(NETFX_CORE || PORTABLE) 82 | Thread.MemoryBarrier(); 83 | #endif 84 | _store = newStore; 85 | } 86 | 87 | return value; 88 | } 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Utilities/ReflectionDelegateFactory.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Globalization; 28 | using System.Reflection; 29 | using Newtonsoft.Json.Serialization; 30 | 31 | #if NET20 32 | using Newtonsoft.Json.Utilities.LinqBridge; 33 | #endif 34 | 35 | namespace Newtonsoft.Json.Utilities 36 | { 37 | internal abstract class ReflectionDelegateFactory 38 | { 39 | public Func CreateGet(MemberInfo memberInfo) 40 | { 41 | PropertyInfo propertyInfo = memberInfo as PropertyInfo; 42 | if (propertyInfo != null) 43 | return CreateGet(propertyInfo); 44 | 45 | FieldInfo fieldInfo = memberInfo as FieldInfo; 46 | if (fieldInfo != null) 47 | return CreateGet(fieldInfo); 48 | 49 | throw new Exception("Could not create getter for {0}.".FormatWith(CultureInfo.InvariantCulture, memberInfo)); 50 | } 51 | 52 | public Action CreateSet(MemberInfo memberInfo) 53 | { 54 | PropertyInfo propertyInfo = memberInfo as PropertyInfo; 55 | if (propertyInfo != null) 56 | return CreateSet(propertyInfo); 57 | 58 | FieldInfo fieldInfo = memberInfo as FieldInfo; 59 | if (fieldInfo != null) 60 | return CreateSet(fieldInfo); 61 | 62 | throw new Exception("Could not create setter for {0}.".FormatWith(CultureInfo.InvariantCulture, memberInfo)); 63 | } 64 | 65 | public abstract MethodCall CreateMethodCall(MethodBase method); 66 | public abstract ObjectConstructor CreateParametrizedConstructor(MethodBase method); 67 | public abstract Func CreateDefaultConstructor(Type type); 68 | public abstract Func CreateGet(PropertyInfo propertyInfo); 69 | public abstract Func CreateGet(FieldInfo fieldInfo); 70 | public abstract Action CreateSet(FieldInfo fieldInfo); 71 | public abstract Action CreateSet(PropertyInfo propertyInfo); 72 | } 73 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/MemoryTraceWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Globalization; 5 | using System.Text; 6 | 7 | namespace Newtonsoft.Json.Serialization 8 | { 9 | /// 10 | /// Represents a trace writer that writes to memory. When the trace message limit is 11 | /// reached then old trace messages will be removed as new messages are added. 12 | /// 13 | public class MemoryTraceWriter : ITraceWriter 14 | { 15 | private readonly Queue _traceMessages; 16 | 17 | /// 18 | /// Gets the that will be used to filter the trace messages passed to the writer. 19 | /// For example a filter level of Info will exclude Verbose messages and include Info, 20 | /// Warning and Error messages. 21 | /// 22 | /// 23 | /// The that will be used to filter the trace messages passed to the writer. 24 | /// 25 | public TraceLevel LevelFilter { get; set; } 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | public MemoryTraceWriter() 31 | { 32 | LevelFilter = TraceLevel.Verbose; 33 | _traceMessages = new Queue(); 34 | } 35 | 36 | /// 37 | /// Writes the specified trace level, message and optional exception. 38 | /// 39 | /// The at which to write this trace. 40 | /// The trace message. 41 | /// The trace exception. This parameter is optional. 42 | public void Trace(TraceLevel level, string message, Exception ex) 43 | { 44 | string traceMessage = DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff", CultureInfo.InvariantCulture) + " " + level.ToString("g") + " " + message; 45 | 46 | if (_traceMessages.Count >= 1000) 47 | _traceMessages.Dequeue(); 48 | 49 | _traceMessages.Enqueue(traceMessage); 50 | } 51 | 52 | /// 53 | /// Returns an enumeration of the most recent trace messages. 54 | /// 55 | /// An enumeration of the most recent trace messages. 56 | public IEnumerable GetTraceMessages() 57 | { 58 | return _traceMessages; 59 | } 60 | 61 | /// 62 | /// Returns a of the most recent trace messages. 63 | /// 64 | /// 65 | /// A of the most recent trace messages. 66 | /// 67 | public override string ToString() 68 | { 69 | StringBuilder sb = new StringBuilder(); 70 | foreach (string traceMessage in _traceMessages) 71 | { 72 | if (sb.Length > 0) 73 | sb.AppendLine(); 74 | 75 | sb.Append(traceMessage); 76 | } 77 | 78 | return sb.ToString(); 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/DefaultReferenceResolver.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using Newtonsoft.Json.Utilities; 28 | using System.Globalization; 29 | 30 | namespace Newtonsoft.Json.Serialization 31 | { 32 | internal class DefaultReferenceResolver : IReferenceResolver 33 | { 34 | private int _referenceCount; 35 | 36 | private BidirectionalDictionary GetMappings(object context) 37 | { 38 | JsonSerializerInternalBase internalSerializer; 39 | 40 | if (context is JsonSerializerInternalBase) 41 | internalSerializer = (JsonSerializerInternalBase)context; 42 | else if (context is JsonSerializerProxy) 43 | internalSerializer = ((JsonSerializerProxy)context).GetInternalSerializer(); 44 | else 45 | throw new JsonException("The DefaultReferenceResolver can only be used internally."); 46 | 47 | return internalSerializer.DefaultReferenceMappings; 48 | } 49 | 50 | public object ResolveReference(object context, string reference) 51 | { 52 | object value; 53 | GetMappings(context).TryGetByFirst(reference, out value); 54 | return value; 55 | } 56 | 57 | public string GetReference(object context, object value) 58 | { 59 | var mappings = GetMappings(context); 60 | 61 | string reference; 62 | if (!mappings.TryGetBySecond(value, out reference)) 63 | { 64 | _referenceCount++; 65 | reference = _referenceCount.ToString(CultureInfo.InvariantCulture); 66 | mappings.Set(reference, value); 67 | } 68 | 69 | return reference; 70 | } 71 | 72 | public void AddReference(object context, string reference, object value) 73 | { 74 | GetMappings(context).Set(reference, value); 75 | } 76 | 77 | public bool IsReferenced(object context, object value) 78 | { 79 | string reference; 80 | return GetMappings(context).TryGetBySecond(value, out reference); 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/DefaultValueHandling.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.ComponentModel; 28 | 29 | namespace Newtonsoft.Json 30 | { 31 | /// 32 | /// Specifies default value handling options for the . 33 | /// 34 | /// 35 | /// 36 | /// 37 | /// 38 | [Flags] 39 | public enum DefaultValueHandling 40 | { 41 | /// 42 | /// Include members where the member value is the same as the member's default value when serializing objects. 43 | /// Included members are written to JSON. Has no effect when deserializing. 44 | /// 45 | Include = 0, 46 | 47 | /// 48 | /// Ignore members where the member value is the same as the member's default value when serializing objects 49 | /// so that is is not written to JSON. 50 | /// This option will ignore all default values (e.g. null for objects and nullable types; 0 for integers, 51 | /// decimals and floating point numbers; and false for booleans). The default value ignored can be changed by 52 | /// placing the on the property. 53 | /// 54 | Ignore = 1, 55 | 56 | /// 57 | /// Members with a default value but no JSON will be set to their default value when deserializing. 58 | /// 59 | Populate = 2, 60 | 61 | /// 62 | /// Ignore members where the member value is the same as the member's default value when serializing objects 63 | /// and sets members to their default value when deserializing. 64 | /// 65 | IgnoreAndPopulate = Ignore | Populate 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /OneDrive/Dependencies/Newtonsoft.Json/Serialization/ReflectionAttributeProvider.cs: -------------------------------------------------------------------------------- 1 | #region License 2 | // Copyright (c) 2007 James Newton-King 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | #endregion 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Reflection; 29 | using Newtonsoft.Json.Utilities; 30 | 31 | namespace Newtonsoft.Json.Serialization 32 | { 33 | /// 34 | /// Provides methods to get attributes from a , , or . 35 | /// 36 | public class ReflectionAttributeProvider : IAttributeProvider 37 | { 38 | private readonly object _attributeProvider; 39 | 40 | /// 41 | /// Initializes a new instance of the class. 42 | /// 43 | public ReflectionAttributeProvider(object attributeProvider) 44 | { 45 | ValidationUtils.ArgumentNotNull(attributeProvider, "attributeProvider"); 46 | _attributeProvider = attributeProvider; 47 | } 48 | 49 | /// 50 | /// Returns a collection of all of the attributes, or an empty collection if there are no attributes. 51 | /// 52 | /// When true, look up the hierarchy chain for the inherited custom attribute. 53 | /// A collection of s, or an empty collection. 54 | public IList GetAttributes(bool inherit) 55 | { 56 | return ReflectionUtils.GetAttributes(_attributeProvider, null, inherit); 57 | } 58 | 59 | /// 60 | /// Returns a collection of attributes, identified by type, or an empty collection if there are no attributes. 61 | /// 62 | /// The type of the attributes. 63 | /// When true, look up the hierarchy chain for the inherited custom attribute. 64 | /// A collection of s, or an empty collection. 65 | public IList GetAttributes(Type attributeType, bool inherit) 66 | { 67 | return ReflectionUtils.GetAttributes(_attributeProvider, attributeType, inherit); 68 | } 69 | } 70 | } --------------------------------------------------------------------------------
To setup Emby Bookshelf, just add a media library in Emby library setup and set the content type to Books.
Info
Verbose
Warning
Error