Example #1
0
 private void RenderDirectoryItem(DirectoryItem item)
 {
     Response.AppendFormat(
         "<li><a href='{0}' class='{1}'>",
         GenerateDirectoryItemUrl(item),
         item.IsDirectory ? "diritem" : "fileitem");
     Response.Append(Path.GetFileName(item.Path));
     Response.AppendLine("</a></li>");
 }
Example #2
0
        public DirectoryItem[] ListDirectoryItems(string path)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(GetFullPath(path));

            FileSystemInfo[]     stringItems    = dirInfo.GetFileSystemInfos();
            List <DirectoryItem> directoryItems = new List <DirectoryItem>();

            string rootFullPath = Path.GetFullPath(configuration.SourceCodeRootDirectory);

            foreach (FileSystemInfo fileSystemInfo in stringItems)
            {
                string itemFullPath = Path.Combine(path, fileSystemInfo.FullName);
                bool   isDirectory  = IsDirectory(itemFullPath);

                string itemRelativePath = itemFullPath.Substring(rootFullPath.Length);

                DirectoryItem item = new DirectoryItem(itemRelativePath, isDirectory);
                directoryItems.Add(item);
            }

            return(directoryItems.ToArray());
        }
Example #3
0
 private string GenerateDirectoryItemUrl(DirectoryItem directoryItem)
 {
     return(basePath + ConvertToWebSafePath(directoryItem.Path));
 }