コード例 #1
0
        RelocationError enc.IEncodable <RelocationError> .Decode(enc.IDecoder decoder)
        {
            switch (decoder.GetUnionName())
            {
            case "from_lookup":
                using (var obj = decoder.GetObject())
                {
                    return(new FromLookup(obj.GetFieldObject <LookupError>("from_lookup")));
                }

            case "from_write":
                using (var obj = decoder.GetObject())
                {
                    return(new FromWrite(obj.GetFieldObject <WriteError>("from_write")));
                }

            case "to":
                using (var obj = decoder.GetObject())
                {
                    return(new To(obj.GetFieldObject <WriteError>("to")));
                }

            case "cant_copy_shared_folder":
                return(CantCopySharedFolder.Instance);

            case "cant_nest_shared_folder":
                return(CantNestSharedFolder.Instance);

            case "too_many_files":
                return(TooManyFiles.Instance);

            default:
                return(Other.Instance);
            }
        }
コード例 #2
0
        LinkMetadata enc.IEncodable <LinkMetadata> .Decode(enc.IDecoder decoder)
        {
            var tag = string.Empty;

            using (var obj = decoder.GetObject())
            {
                tag = obj.GetField <string>(".tag");
            }

            switch (tag)
            {
            case "path":
                var path = new PathLinkMetadata();
                return(((enc.IEncodable <PathLinkMetadata>)path).Decode(decoder));

            case "collection":
                var collection = new CollectionLinkMetadata();
                return(((enc.IEncodable <CollectionLinkMetadata>)collection).Decode(decoder));

            default:
                using (var obj = decoder.GetObject())
                {
                    this.Url        = obj.GetField <string>("url");
                    this.Visibility = obj.GetFieldObject <Visibility>("visibility");
                    if (obj.HasField("expires"))
                    {
                        this.Expires = obj.GetField <sys.DateTime>("expires");
                    }
                }

                return(this);
            }
        }
コード例 #3
0
        WriteError enc.IEncodable <WriteError> .Decode(enc.IDecoder decoder)
        {
            switch (decoder.GetUnionName())
            {
            case "malformed_path":
                using (var obj = decoder.GetObject())
                {
                    return(new MalformedPath(obj.GetField <string>("malformed_path")));
                }

            case "conflict":
                using (var obj = decoder.GetObject())
                {
                    return(new Conflict(obj.GetFieldObject <WriteConflictError>("conflict")));
                }

            case "no_write_permission":
                return(NoWritePermission.Instance);

            case "insufficient_space":
                return(InsufficientSpace.Instance);

            case "disallowed_name":
                return(DisallowedName.Instance);

            default:
                return(Other.Instance);
            }
        }
コード例 #4
0
        CommitInfo enc.IEncodable <CommitInfo> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Path = obj.GetField <string>("path");
                if (obj.HasField("mode"))
                {
                    this.Mode = obj.GetFieldObject <WriteMode>("mode");
                }
                if (obj.HasField("autorename"))
                {
                    this.Autorename = obj.GetField <bool>("autorename");
                }
                if (obj.HasField("client_modified"))
                {
                    this.ClientModified = obj.GetField <sys.DateTime>("client_modified");
                }
                if (obj.HasField("mute"))
                {
                    this.Mute = obj.GetField <bool>("mute");
                }
            }

            return(this);
        }
コード例 #5
0
        LookupError enc.IEncodable <LookupError> .Decode(enc.IDecoder decoder)
        {
            switch (decoder.GetUnionName())
            {
            case "malformed_path":
                using (var obj = decoder.GetObject())
                {
                    return(new MalformedPath(obj.GetField <string>("malformed_path")));
                }

            case "not_found":
                return(NotFound.Instance);

            case "not_file":
                return(NotFile.Instance);

            case "not_folder":
                return(NotFolder.Instance);

            case "restricted_content":
                return(RestrictedContent.Instance);

            default:
                return(Other.Instance);
            }
        }
コード例 #6
0
        Metadata enc.IEncodable <Metadata> .Decode(enc.IDecoder decoder)
        {
            var tag = string.Empty;

            using (var obj = decoder.GetObject())
            {
                tag = obj.GetField <string>(".tag");
            }

            switch (tag)
            {
            case "file":
                var file = new FileMetadata();
                return(((enc.IEncodable <FileMetadata>)file).Decode(decoder));

            case "folder":
                var folder = new FolderMetadata();
                return(((enc.IEncodable <FolderMetadata>)folder).Decode(decoder));

            case "deleted":
                var deleted = new DeletedMetadata();
                return(((enc.IEncodable <DeletedMetadata>)deleted).Decode(decoder));

            default:
                throw new sys.InvalidOperationException();
            }
        }
コード例 #7
0
        ListFolderContinueArg enc.IEncodable <ListFolderContinueArg> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Cursor = obj.GetField <string>("cursor");
            }

            return(this);
        }
コード例 #8
0
        ListFolderGetLatestCursorResult enc.IEncodable <ListFolderGetLatestCursorResult> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Cursor = obj.GetField <string>("cursor");
            }

            return(this);
        }
コード例 #9
0
        GetMetadataArg enc.IEncodable <GetMetadataArg> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Path = obj.GetField <string>("path");
            }

            return(this);
        }
コード例 #10
0
        UploadSessionOffsetError enc.IEncodable <UploadSessionOffsetError> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.CorrectOffset = obj.GetField <ulong>("correct_offset");
            }

            return(this);
        }
コード例 #11
0
        GetSharedLinksResult enc.IEncodable <GetSharedLinksResult> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Links = new col.List <LinkMetadata>(obj.GetFieldObjectList <LinkMetadata>("links"));
            }

            return(this);
        }
コード例 #12
0
        ListSharedFoldersResult enc.IEncodable <ListSharedFoldersResult> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Entries = new col.List <SharedFolderMetadata>(obj.GetFieldObjectList <SharedFolderMetadata>("entries"));
            }

            return(this);
        }
コード例 #13
0
        MembershipInfo enc.IEncodable <MembershipInfo> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.AccessType = obj.GetFieldObject <AccessType>("access_type");
            }

            return(this);
        }
コード例 #14
0
        UploadSessionStartResult enc.IEncodable <UploadSessionStartResult> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.SessionId = obj.GetField <string>("session_id");
            }

            return(this);
        }
コード例 #15
0
        IndividualSpaceAllocation enc.IEncodable <IndividualSpaceAllocation> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Allocated = obj.GetField <ulong>("allocated");
            }

            return(this);
        }
コード例 #16
0
        GetAccountArg enc.IEncodable <GetAccountArg> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.AccountId = obj.GetField <string>("account_id");
            }

            return(this);
        }
コード例 #17
0
        UploadWriteFailed enc.IEncodable <UploadWriteFailed> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Reason          = obj.GetFieldObject <WriteError>("reason");
                this.UploadSessionId = obj.GetField <string>("upload_session_id");
            }

            return(this);
        }
コード例 #18
0
        ListRevisionsResult enc.IEncodable <ListRevisionsResult> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.IsDeleted = obj.GetField <bool>("is_deleted");
                this.Entries   = new col.List <FileMetadata>(obj.GetFieldObjectList <FileMetadata>("entries"));
            }

            return(this);
        }
コード例 #19
0
        RestoreArg enc.IEncodable <RestoreArg> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Path = obj.GetField <string>("path");
                this.Rev  = obj.GetField <string>("rev");
            }

            return(this);
        }
コード例 #20
0
        Team enc.IEncodable <Team> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Id   = obj.GetField <string>("id");
                this.Name = obj.GetField <string>("name");
            }

            return(this);
        }
コード例 #21
0
        RelocationArg enc.IEncodable <RelocationArg> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.FromPath = obj.GetField <string>("from_path");
                this.ToPath   = obj.GetField <string>("to_path");
            }

            return(this);
        }
コード例 #22
0
        SpaceUsage enc.IEncodable <SpaceUsage> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Used       = obj.GetField <ulong>("used");
                this.Allocation = obj.GetFieldObject <SpaceAllocation>("allocation");
            }

            return(this);
        }
コード例 #23
0
ファイル: Account.cs プロジェクト: momla/dropbox-sdk-dotnet
        Account enc.IEncodable <Account> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.AccountId = obj.GetField <string>("account_id");
                this.Name      = obj.GetFieldObject <Name>("name");
            }

            return(this);
        }
コード例 #24
0
        SearchMatch enc.IEncodable <SearchMatch> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.MatchType = obj.GetFieldObject <SearchMatchType>("match_type");
                this.Metadata  = obj.GetFieldObject <Metadata>("metadata");
            }

            return(this);
        }
コード例 #25
0
        UploadSessionFinishArg enc.IEncodable <UploadSessionFinishArg> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Cursor = obj.GetFieldObject <UploadSessionCursor>("cursor");
                this.Commit = obj.GetFieldObject <CommitInfo>("commit");
            }

            return(this);
        }
コード例 #26
0
        UploadSessionCursor enc.IEncodable <UploadSessionCursor> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.SessionId = obj.GetField <string>("session_id");
                this.Offset    = obj.GetField <ulong>("offset");
            }

            return(this);
        }
コード例 #27
0
        DeletedMetadata enc.IEncodable <DeletedMetadata> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Name      = obj.GetField <string>("name");
                this.PathLower = obj.GetField <string>("path_lower");
            }

            return(this);
        }
コード例 #28
0
        DeleteError enc.IEncodable <DeleteError> .Decode(enc.IDecoder decoder)
        {
            switch (decoder.GetUnionName())
            {
            case "path_lookup":
                using (var obj = decoder.GetObject())
                {
                    return(new PathLookup(obj.GetFieldObject <LookupError>("path_lookup")));
                }

            case "path_write":
                using (var obj = decoder.GetObject())
                {
                    return(new PathWrite(obj.GetFieldObject <WriteError>("path_write")));
                }

            default:
                return(Other.Instance);
            }
        }
コード例 #29
0
        SpaceAllocation enc.IEncodable <SpaceAllocation> .Decode(enc.IDecoder decoder)
        {
            switch (decoder.GetUnionName())
            {
            case "individual":
                using (var obj = decoder.GetObject())
                {
                    return(new Individual(obj.GetFieldObject <IndividualSpaceAllocation>("individual")));
                }

            case "team":
                using (var obj = decoder.GetObject())
                {
                    return(new Team(obj.GetFieldObject <TeamSpaceAllocation>("team")));
                }

            default:
                return(Other.Instance);
            }
        }
コード例 #30
0
        ListFolderResult enc.IEncodable <ListFolderResult> .Decode(enc.IDecoder decoder)
        {
            using (var obj = decoder.GetObject())
            {
                this.Entries = new col.List <Metadata>(obj.GetFieldObjectList <Metadata>("entries"));
                this.Cursor  = obj.GetField <string>("cursor");
                this.HasMore = obj.GetField <bool>("has_more");
            }

            return(this);
        }