/// <summary> /// Handles actions related to the folders. /// </summary> /// <param name="argument">Argument related to the folder action</param> /// <param name="forceReload">Indicates if load should be forced</param> private void HandleFolderAction(string argument, bool forceReload) { NodeID = ValidationHelper.GetString(argument, string.Empty); // Reload content tree if necessary if (forceReload) { InitializeFileSystemTree(); // Fill with new info treeFileSystem.DefaultPath = NodeID; treeFileSystem.ExpandDefaultPath = true; treeFileSystem.ReloadData(); pnlUpdateTree.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "EnsureTopWindow", "if (self.focus) { self.focus(); }", true); } ColorizeLastSelectedRow(); // Get parent node ID info string parentId = string.Empty; if (FullStartingPath.ToLowerCSafe() != NodeID.ToLowerCSafe()) { try { parentId = (DirectoryInfo.New(NodeID)).Parent.FullName; } // Access denied to parent catch (SecurityException) { } } menuElem.ShowParentButton = !String.IsNullOrEmpty(parentId); menuElem.NodeParentID = parentId; fileSystemView.Config = Config; // Load new data if ((Config.ShowFolders) && (NodeID.LastIndexOfCSafe('\\') != -1)) { fileSystemView.StartingPath = NodeID.Substring(0, argument.LastIndexOfCSafe('\\') + 1); } fileSystemView.StartingPath = NodeID; // Reload view control's content fileSystemView.Reload(); pnlUpdateView.Update(); InitializeMenuElem(); menuElem.UpdateActionsMenu(); folderActions.Update(); pnlUpdateMenu.Update(); ClearActionElems(); }
/// <summary> /// Check if folder is allowed and not excluded. /// </summary> /// <param name="info">DiretoryInfo to check</param> /// <returns>True if folder is allowed and not excluded otherwise false</returns> private bool IsAllowedAndNotExcludedFolder(DirectoryInfo info) { bool isAllowed = false; bool isExcluded = false; string startPath = Path.EnsureEndBackslash(FullStartingPath.ToLowerCSafe()); string folderName = info.FullName.ToLowerCSafe(); // Check if folder is allowed if (String.IsNullOrEmpty(Configuration.AllowedFolders)) { isAllowed = true; } else { foreach (string path in Configuration.AllowedFolders.ToLowerCSafe().Split(';')) { if (folderName.StartsWithCSafe(startPath + path)) { isAllowed = true; } } } // Check if folder isn't excluded if (!String.IsNullOrEmpty(Configuration.ExcludedFolders)) { foreach (string path in Configuration.ExcludedFolders.ToLowerCSafe().Split(';')) { if (folderName.StartsWithCSafe(startPath + path)) { isExcluded = true; } } } return((isAllowed) && (!isExcluded)); }