Beispiel #1
0
        public object RenameFolder(Folder folder, string newTitle)
        {
            var driveFolder = GetDriveEntry(folder.ID);

            if (IsRoot(driveFolder))
            {
                //It's root folder
                GoogleDriveDaoSelector.RenameProvider(GoogleDriveProviderInfo, newTitle);
                //rename provider customer title
            }
            else
            {
                //rename folder
                driveFolder.Title = newTitle;
                driveFolder       = GoogleDriveProviderInfo.Storage.UpdateEntry(driveFolder);
            }

            CacheInsert(driveFolder);
            var parentDriveId = GetParentDriveId(driveFolder);

            if (parentDriveId != null)
            {
                CacheReset(parentDriveId, true);
            }

            return(MakeId(driveFolder.Id));
        }
Beispiel #2
0
        public object RenameFolder(object folderId, string newTitle)
        {
            var folder = GetFolderById(folderId);

            var oldId = MakeId(folder);
            var newId = oldId;

            if ("/".Equals(MakePath(folderId)))
            {
                //It's root folder
                GoogleDriveDaoSelector.RenameProvider(GoogleDriveProviderInfo, newTitle);
                //rename provider customer title
            }
            else
            {
                //rename folder
                if (GoogleDriveProviderInfo.Storage.RenameFileSystemEntry(folder, newTitle))
                {
                    //Folder data must be already updated by provider
                    //We can't search google folders by title because root can have multiple folders with the same name
                    //var newFolder = GoogleDriveProviderInfo.Storage.GetFileSystemObject(newTitle, folder.Parent);
                    newId = MakeId(folder);
                }
            }

            UpdatePathInDB(oldId, newId);

            return(newId);
        }