Ejemplo n.º 1
0
        public List <FileEntryWrapper> GetNewItems(T folderId)
        {
            return(FileStorageService.GetNewItems(folderId)
                   .Select(r =>
            {
                FileEntryWrapper wrapper = null;
                if (r is Folder <int> fol1)
                {
                    wrapper = FolderWrapperHelper.Get(fol1);
                }
                else if (r is Folder <string> fol2)
                {
                    wrapper = FolderWrapperHelper.Get(fol2);
                }
                else if (r is File <int> file1)
                {
                    wrapper = FileWrapperHelper.Get(file1);
                }
                else if (r is File <string> file2)
                {
                    wrapper = FileWrapperHelper.Get(file2);
                }

                return wrapper;
            })
                   .ToList());
        }
Ejemplo n.º 2
0
        public IEnumerable <FileEntryWrapper> MoveOrCopyBatchCheck(BatchModel batchModel)
        {
            var checkedFiles   = new List <object>();
            var checkedFolders = new List <object>();

            if (batchModel.DestFolderId.ValueKind == System.Text.Json.JsonValueKind.Number)
            {
                (checkedFiles, checkedFolders) = FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId);
            }
            else
            {
                (checkedFiles, checkedFolders) = FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId);
            }

            var entries = FileStorageService.GetItems(checkedFiles.OfType <int>().Select(Convert.ToInt32), checkedFiles.OfType <int>().Select(Convert.ToInt32), FilterType.FilesOnly, false, "", "");

            entries.AddRange(FileStorageService.GetItems(checkedFiles.OfType <string>(), checkedFiles.OfType <string>(), FilterType.FilesOnly, false, "", ""));

            return(entries.Select(r =>
            {
                FileEntryWrapper wrapper = null;
                if (r is Folder <int> fol1)
                {
                    wrapper = FolderWrapperHelper.Get(fol1);
                }
                if (r is Folder <string> fol2)
                {
                    wrapper = FolderWrapperHelper.Get(fol2);
                }

                return wrapper;
            }));
        }
Ejemplo n.º 3
0
        internal FileEntryWrapper GetFileEntryWrapper(FileEntry r)
        {
            FileEntryWrapper wrapper = null;

            if (r is Folder <int> fol1)
            {
                wrapper = FolderWrapperHelper.Get(fol1);
            }
            else if (r is Folder <string> fol2)
            {
                wrapper = FolderWrapperHelper.Get(fol2);
            }
            else if (r is File <int> file1)
            {
                wrapper = FileWrapperHelper.Get(file1);
            }
            else if (r is File <string> file2)
            {
                wrapper = FileWrapperHelper.Get(file2);
            }

            return(wrapper);
        }
Ejemplo n.º 4
0
        public FolderWrapper <T> SaveThirdParty(
            string url,
            string login,
            string password,
            string token,
            bool isCorporate,
            string customerTitle,
            string providerKey,
            string providerId)
        {
            var thirdPartyParams = new ThirdPartyParams
            {
                AuthData      = new AuthData(url, login, password, token),
                Corporate     = isCorporate,
                CustomerTitle = customerTitle,
                ProviderId    = providerId,
                ProviderKey   = providerKey,
            };

            var folder = FileStorageService.SaveThirdParty(thirdPartyParams);

            return(FolderWrapperHelper.Get(folder));
        }
Ejemplo n.º 5
0
        public IEnumerable <FileEntryWrapper> MoveOrCopyBatchCheck(BatchModel batchModel)
        {
            FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId, out var checkedFiles, out var checkedFolders);

            var entries = FileStorageService.GetItems(checkedFiles.OfType <long>().Select(Convert.ToInt32), checkedFiles.OfType <long>().Select(Convert.ToInt32), FilterType.FilesOnly, false, "", "");

            entries.AddRange(FileStorageService.GetItems(checkedFiles.OfType <string>(), checkedFiles.OfType <string>(), FilterType.FilesOnly, false, "", ""));

            return(entries.Select(r =>
            {
                FileEntryWrapper wrapper = null;
                if (r is Folder <int> fol1)
                {
                    wrapper = FolderWrapperHelper.Get(fol1);
                }
                if (r is Folder <string> fol2)
                {
                    wrapper = FolderWrapperHelper.Get(fol2);
                }

                return wrapper;
            }));
        }
Ejemplo n.º 6
0
        public FolderWrapper <T> GetFolderInfo(T folderId)
        {
            var folder = FileStorageService.GetFolder(folderId).NotFoundIfNull("Folder not found");

            return(FolderWrapperHelper.Get(folder));
        }
Ejemplo n.º 7
0
        public FolderWrapper <T> RenameFolder(T folderId, string title)
        {
            var folder = FileStorageService.FolderRename(folderId, title);

            return(FolderWrapperHelper.Get(folder));
        }
Ejemplo n.º 8
0
        public FolderWrapper <T> CreateFolder(T folderId, string title)
        {
            var folder = FileStorageService.CreateNewFolder(folderId, title);

            return(FolderWrapperHelper.Get(folder));
        }