public static string UnzipFiles(string FilePath, int FolderID, int portalID, string userName, int userModuleID, string secureToken) { StringBuilder sb = new StringBuilder(); AuthenticateService objService = new AuthenticateService(); if (objService.IsPostAuthenticatedView(portalID, userModuleID, userName, secureToken)) { string absolutePath = GetAbsolutePath(FilePath); FileInfo file = new FileInfo(absolutePath); string folderName = file.Name; string newFolderPath = FileManagerHelper.GetFilePathWithoutExtension(absolutePath); DirectoryInfo dir = new DirectoryInfo(newFolderPath); if (!dir.Exists) { string path = string.Empty; FileManagerHelper.UnZipFiles(absolutePath, newFolderPath, ref path, SageFrame.Common.RegisterModule.Common.Password, false, userModuleID, fb.GetPortalID); Folder folder = new Folder(); folder.PortalId = fb.GetPortalID; folder.ParentID = FolderID; folder.FolderPath = FileManagerHelper.ReplaceBackSlash(FileManagerHelper.GetFilePathWithoutExtension(FilePath)); folder.StorageLocation = 0; folder.UniqueId = Guid.NewGuid(); folder.VersionGuid = Guid.NewGuid(); folder.IsActive = 1; folder.IsRoot = false; folder.AddedBy = fb.GetUsername; try { int folderID = FileManagerController.AddFolderReturnFolderID(folder); RecurseThroughDirectory(dir, folderID, userModuleID, ref sb); } catch (Exception ex) { fb.ProcessException(ex); } } CacheHelper.Clear("FileManagerFileList"); CacheHelper.Clear("FileManagerFolders"); } return(sb.ToString()); }
public static string UnzipFiles(string FilePath, int FolderID, int portalID, string userName, int userModuleID, string secureToken) { StringBuilder sb = new StringBuilder(); AuthenticateService objService = new AuthenticateService(); if (objService.IsPostAuthenticatedView(portalID, userModuleID, userName, secureToken)) { string absolutePath = GetAbsolutePath(FilePath); FileInfo file = new FileInfo(absolutePath); string folderName = file.Name; string newFolderPath = FileManagerHelper.GetFilePathWithoutExtension(absolutePath); DirectoryInfo dir = new DirectoryInfo(newFolderPath); if (!dir.Exists) { string path = string.Empty; FileManagerHelper.UnZipFiles(absolutePath, newFolderPath, ref path, SageFrame.Common.RegisterModule.Common.Password, false, userModuleID, fb.GetPortalID); Folder folder = new Folder(); } CacheHelper.Clear("FileManagerFileList"); CacheHelper.Clear("FileManagerFolders"); } return(sb.ToString()); }