1 <%@ page language="C#" %>
2 <%@ import namespace="System.IO" %>
5 <script runat="server">
6 protected override void OnLoad (EventArgs args)
9 DirectoryInfo dir = new DirectoryInfo (Path.GetDirectoryName (Request.PhysicalPath));
10 StringBuilder sb = new StringBuilder ();
12 sb.Append (ReadDirectory (Path.Combine (Path.GetDirectoryName (Request.PhysicalPath), String.Empty), String.Empty));
14 fileList.InnerHtml = sb.ToString ();
17 public string ReadDirectory (string path, string basePath)
19 StringBuilder sb = new StringBuilder ();
20 foreach (string sdir in Directory.GetDirectories (path)) {
21 string s = ReadDirectory (sdir, basePath + Path.GetFileName (sdir) + "/");
23 sb.AppendFormat ("<li><b>{0}</b><ul>{1}</ul></li>", Path.GetFileName (sdir), s);
25 foreach (string file in Directory.GetFiles (path)) {
26 string fileName = basePath + Path.GetFileName (file);
27 string extension = Path.GetExtension (file);
28 if (extension == ".xaml") {
29 sb.AppendFormat ("<li><a class=\"{2}\" href=\"xamlize.aspx?xaml={1}\">{0}</a></li>\n",
30 Path.GetFileName (fileName), fileName, extension.Substring (1));
32 if (extension == ".htm" || extension == ".html") {
33 sb.AppendFormat ("<li><a class=\"{2}\" href=\"{1}\">{0}</a></li>\n",
34 Path.GetFileName (fileName), fileName, extension.Substring (1));
38 return sb.ToString ();
45 <span id="fileList" runat="server" />
48 <div style="text-align: left; font-size: small;">Generated: <%= DateTime.Now %></div>