public DropboxFileSystemProvider(IDropboxService dropbox,IZinOSDesktopDropboxAccount zinOSDesktopDropboxAccount)
        {
            _dropboxService = dropbox;
            _zinOSDesktopDropboxAccount = zinOSDesktopDropboxAccount;

            _rootFileSystemItem = new FileSystemItem {
                IsDirectory = true,
                Path =  String.Format(@"\{0}", DropboxProviderName),
                Name = DropboxProviderName
            };
        }
        public IEnumerable<FileSystemItem> GetChildrenItems(int desktopId, FileSystemItem parentfileSystemItem)
        {
            if (validatePath(parentfileSystemItem.Path))
            {
                string providerName = getProviderName(parentfileSystemItem.Path);

                var provider = _fileSystemProviders[providerName];

                if (provider == null) //Invalid path 'fileSystemItem.Path'
                    return null; //TODO: throw exception

                return provider.GetChildrenItems(desktopId, parentfileSystemItem);
            }

            //Invalid path 'fileSystemItem.Path'
            return null; //TODO: throw exception
        }
        public IEnumerable<FileSystemItem> GetChildrenItems(int desktopId, FileSystemItem parent)
        {
            var absolutePath = GetLocalFileSystemRelativePath(desktopId, parent.Path);

            var fileNames = _localFileSystemService.GetChildrenFileNames(FileSystemRoot.Main, absolutePath);
            var dirNames = _localFileSystemService.GetChildrenDirectoryNames(FileSystemRoot.Main, absolutePath);

            var childrens = from filename in fileNames
                            select new FileSystemItem
                                       {
                                           Path = String.Format(@"{0}\{1}", parent.Path, filename),
                                           Name = filename,
                                           IsDirectory = false
                                       };
            return childrens.Concat(from dirName in dirNames
                                    select new FileSystemItem
                                               {
                                                   Path = String.Format(@"{0}\{1}", parent.Path, dirName),
                                                   Name = dirName,
                                                   IsDirectory = true
                                               });
        }
        public Stream GetFile(int desktopId, FileSystemItem fileSystemItem)
        {
            if (!validatePath(fileSystemItem.Path))
                return null;

            var providerName = getProviderName(fileSystemItem.Path);
            var provider = _fileSystemProviders[providerName];

            return provider == null ? null : provider.GetFile(desktopId, fileSystemItem);
        }
 public Stream GetFile(int desktopId, FileSystemItem fileSystemItem)
 {
     var filePath = GetLocalFileSystemRelativePath(desktopId, fileSystemItem.Path);
     return _localFileSystemService.GetFileStream(FileSystemRoot.Main, filePath);
 }
 private void FormatToDropboxPath(FileSystemItem item)
 {
     item.Path = FormatToDropboxPath(item.Path);
 }
        public Stream GetFile(int desktopId, FileSystemItem fileSystemItem)
        {
            string accessToken, tokenSecret;
            GetDesktopDropboxToken(desktopId, out accessToken, out tokenSecret);

            FormatToDropboxPath(fileSystemItem);

            return _dropboxService.GetFileStream(accessToken, tokenSecret, fileSystemItem.Path);
        }
        public IEnumerable<FileSystemItem> GetChildrenItems(int desktopId, FileSystemItem parent)
        {
            string accessToken, tokenSecret;
            GetDesktopDropboxToken(desktopId, out accessToken, out tokenSecret);

            FormatToDropboxPath(parent);

            var fileSystemItems = _dropboxService.GetFileSystemItems(accessToken, tokenSecret, parent.Path);

            // ReSharper disable PossibleMultipleEnumeration
            FormatToZinOSPath(fileSystemItems);
            // ReSharper restore PossibleMultipleEnumeration

            // ReSharper disable PossibleMultipleEnumeration
            return fileSystemItems;
            // ReSharper restore PossibleMultipleEnumeration
        }