public string RenameFolder(Folder <string> folder, string newTitle) { var dropboxFolder = GetDropboxFolder(folder.ID); var parentFolderPath = GetParentFolderPath(dropboxFolder); if (IsRoot(dropboxFolder)) { //It's root folder DaoSelector.RenameProvider(ProviderInfo, newTitle); //rename provider customer title } else { newTitle = GetAvailableTitle(newTitle, parentFolderPath, IsExist); //rename folder dropboxFolder = ProviderInfo.Storage.MoveFolder(MakeDropboxPath(dropboxFolder), parentFolderPath, newTitle); } ProviderInfo.CacheReset(dropboxFolder); if (parentFolderPath != null) { ProviderInfo.CacheReset(parentFolderPath); } return(MakeId(dropboxFolder)); }
public string RenameFolder(Folder <string> folder, string newTitle) { var driveFolder = GetDriveEntry(folder.ID); if (IsRoot(driveFolder)) { //It's root folder DaoSelector.RenameProvider(ProviderInfo, newTitle); //rename provider customer title } else { //rename folder driveFolder.Name = newTitle; driveFolder = ProviderInfo.Storage.RenameEntry(driveFolder.Id, driveFolder.Name); } ProviderInfo.CacheReset(driveFolder); var parentDriveId = GetParentDriveId(driveFolder); if (parentDriveId != null) { ProviderInfo.CacheReset(parentDriveId, true); } return(MakeId(driveFolder.Id)); }
public string RenameFolder(Folder <string> folder, string newTitle) { var entry = GetFolderById(folder.ID); var oldId = MakeId(entry); var newId = oldId; if ("/".Equals(MakePath(folder.ID))) { //It's root folder DaoSelector.RenameProvider(ProviderInfo, newTitle); //rename provider customer title } else { var parentFolder = GetFolderById(folder.ParentFolderID); newTitle = GetAvailableTitle(newTitle, parentFolder, IsExist); //rename folder if (ProviderInfo.Storage.RenameFileSystemEntry(entry, 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 = SharpBoxProviderInfo.Storage.GetFileSystemObject(newTitle, folder.Parent); newId = MakeId(entry); } } UpdatePathInDB(oldId, newId); return(newId); }
public string RenameFolder(Folder <string> folder, string newTitle) { var boxFolder = GetBoxFolder(folder.ID); var parentFolderId = GetParentFolderId(boxFolder); if (IsRoot(boxFolder)) { //It's root folder DaoSelector.RenameProvider(ProviderInfo, newTitle); //rename provider customer title } else { newTitle = GetAvailableTitle(newTitle, parentFolderId, IsExist); //rename folder boxFolder = ProviderInfo.Storage.RenameFolder(boxFolder.Id, newTitle); } ProviderInfo.CacheReset(boxFolder); if (parentFolderId != null) { ProviderInfo.CacheReset(parentFolderId); } return(MakeId(boxFolder.Id)); }
public string RenameFolder(Folder <string> folder, string newTitle) { var oldId = ProviderInfo.MakeId(folder.ID); var newFolderId = oldId; if (ProviderInfo.SpRootFolderId.Equals(folder.ID)) { //It's root folder DaoSelector.RenameProvider(ProviderInfo, newTitle); //rename provider customer title } else { newFolderId = (string)ProviderInfo.RenameFolder(folder.ID, newTitle); } UpdatePathInDB(oldId, newFolderId); return(newFolderId); }