public CloudDriveAdapter(MetaData file)
        {
            this.dropboxFile = file;
            this.googleFile = null;

            this.Title = dropboxFile.Name;
            this.Extension = dropboxFile.Extension;
        }
        public CloudDriveAdapter(File file)
        {
            this.googleFile = file;
            this.dropboxFile = null;

            this.Title = googleFile.Title;
            this.Extension = googleFile.FileExtension;
            this.ThumbnailLink = googleFile.ThumbnailLink;
            this.AlternateLink = googleFile.AlternateLink;
        }
Ejemplo n.º 3
0
        private async Task<List<TreeNode>> GetAndMapChildren(MetaData metadata)
        {
            var result = new List<TreeNode>();

            foreach (var item in metadata.contents)
            {
                var node = new TreeNode
                {
                    Name = item.Name,
                    Path = item.path
                };

                if (item.is_dir)
                {
                    var content = await _client.Core.Metadata.MetadataAsync(item.path, list: true);

                    node.Children = await GetAndMapChildren(content);
                }

                result.Add(node);
            }

            return result;
        }
Ejemplo n.º 4
0
        public void AddAtPath(string path, MetaData meta)
        {
            // this is add or update action (file)
            // lookup file Id
            DocumentStateItem documentAtPath;
            if (_currentState.TryGetValue(path, out documentAtPath))
            {
                documentAtPath.IsDeleted = false;
                _pendingChanges.EnqueueUpdate(documentAtPath, meta);
            }
            else
            {
                // in case this is a file replacing a folder with sub-items, we need to check to
                // ensure the sub-items are removed
                if (AnyFilesUnderPath(path))
                {
                    RemoveItemsUnderPath(path);
                }

                // new path, generate new Id
                documentAtPath = new DocumentStateItem
                {
                    Id = Guid.NewGuid(),
                    FilePath = path
                };

                Add(path, documentAtPath);

                _pendingChanges.EnqueueAdd(documentAtPath, meta);
            }
        }