コード例 #1
0
        public override async Task <ITraktSyncHistoryRemovePostResponse> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            if (jsonReader == null)
            {
                return(await Task.FromResult(default(ITraktSyncHistoryRemovePostResponse)));
            }

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var groupReader         = new SyncHistoryRemovePostResponseGroupObjectJsonReader();
                var notFoundGroupReader = new SyncHistoryRemovePostResponseNotFoundGroupObjectJsonReader();
                ITraktSyncHistoryRemovePostResponse syncHistoryRemovePostResponse = new TraktSyncHistoryRemovePostResponse();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.SYNC_HISTORY_REMOVE_POST_RESPONSE_PROPERTY_NAME_DELETED:
                        syncHistoryRemovePostResponse.Deleted = await groupReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.SYNC_HISTORY_REMOVE_POST_RESPONSE_PROPERTY_NAME_NOT_FOUND:
                        syncHistoryRemovePostResponse.NotFound = await notFoundGroupReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(syncHistoryRemovePostResponse);
            }

            return(await Task.FromResult(default(ITraktSyncHistoryRemovePostResponse)));
        }
コード例 #2
0
        public override async Task <IEnumerable <ITraktSyncHistoryRemovePostResponseNotFoundGroup> > ReadArrayAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            if (jsonReader == null)
            {
                return(await Task.FromResult(default(IEnumerable <ITraktSyncHistoryRemovePostResponseNotFoundGroup>)));
            }

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartArray)
            {
                var syncHistoryRemovePostResponseNotFoundGroupReader = new SyncHistoryRemovePostResponseNotFoundGroupObjectJsonReader();
                var syncHistoryRemovePostResponseNotFoundGroups      = new List <ITraktSyncHistoryRemovePostResponseNotFoundGroup>();
                ITraktSyncHistoryRemovePostResponseNotFoundGroup syncHistoryRemovePostResponseNotFoundGroup = await syncHistoryRemovePostResponseNotFoundGroupReader.ReadObjectAsync(jsonReader, cancellationToken);

                while (syncHistoryRemovePostResponseNotFoundGroup != null)
                {
                    syncHistoryRemovePostResponseNotFoundGroups.Add(syncHistoryRemovePostResponseNotFoundGroup);
                    syncHistoryRemovePostResponseNotFoundGroup = await syncHistoryRemovePostResponseNotFoundGroupReader.ReadObjectAsync(jsonReader, cancellationToken);
                }

                return(syncHistoryRemovePostResponseNotFoundGroups);
            }

            return(await Task.FromResult(default(IEnumerable <ITraktSyncHistoryRemovePostResponseNotFoundGroup>)));
        }