ASP.NET Page /SourceViewer/tabview.aspx (C#)
1: <%@ Page %>
2: <%@ Import Namespace="System.Text" %>
3: <%@ Import Namespace="System.IO" %>
4:
5: <html>
6: <head>
7: <link rel="stylesheet" href="style.css">
8: </head>
9:
10: <script language="C#" runat="server">
11:
12: String width = "100%";
13: String path;
14: String font;
15:
16: void Page_Load(Object sender, EventArgs e) {
17:
18: // Handle .SRC Path
19:
20: path = Request.QueryString["path"];
21:
22:
23: PopulateNavigationList(path);
24: }
25:
26: void PopulateNavigationList(String path) {
27:
28: FileStream fs = new FileStream(Server.MapPath(path), FileMode.Open, FileAccess.Read);
29: StreamReader sr = new StreamReader(fs);
30: String fileName;
31:
32: char [] c1 = { ':' };
33: char [] c2 = { ',' };
34: String line;
35:
36: while ( (line = sr.ReadLine()) != null ) {
37:
38: String [] list = line.Split(c1);
39:
40: if (list.Length > 1) {
41:
42: TableRow row = new TableRow();
43:
44: // Construct Group Label for Items
45:
46: String sourcegroup = list[0];
47:
48: TableCell groupCell = new TableCell();
49: groupCell.Text = "<nobr>" + sourcegroup + ": </nobr>";
50: groupCell.CssClass ="SourceListBold";
51: row.Cells.Add(groupCell);
52:
53:
54: // Construct List of Items
55:
56: String [] sourcelist = list[1].Split(c2);
57:
58: if ((sourcelist.Length>0)) {
59:
60: String dir = Path.GetDirectoryName(path);
61: fileName = Server.MapPath("~/" + ParseItem(sourcelist[0]).HRef);
62: }
63:
64: StringBuilder sb = new StringBuilder();
65:
66: for (int i=0; i< sourcelist.Length; i++) {
67:
68: ItemDetails item = ParseItem(sourcelist[i]);
69:
70: sb.Append("<a class='white' target=docFrame href='" + Request.ApplicationPath + "/docs/" + item.HRef + "'>");
71: sb.Append(Path.GetFileName(item.Description));
72: sb.Append("</a> ");
73: }
74:
75: TableCell itemCell = new TableCell();
76: itemCell.Text = sb.ToString();
77: itemCell.CssClass ="SourceList";
78: row.Cells.Add(itemCell);
79:
80: SourceTable.Rows.Add(row);
81: }
82: }
83:
84: fs.Close();
85: }
86:
87: public ItemDetails ParseItem(String item) {
88:
89: char [] c3 = { '|' };
90:
91: String [] itemParts = item.Split(c3);
92:
93: if (itemParts == null) {
94: return null;
95: }
96:
97: ItemDetails itemDetails = new ItemDetails();
98:
99: if (itemParts.Length > 1) {
100: itemDetails.Description = itemParts[0];
101: itemDetails.HRef = itemParts[1];
102: }
103: else {
104: itemDetails.Description = itemParts[0];
105: itemDetails.HRef = itemParts[0];
106: }
107:
108: return itemDetails;
109: }
110:
111: public class ItemDetails {
112: public String Description;
113: public String HRef;
114: }
115:
116: </script>
117:
118: <body leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0">
119:
120: <form runat="server">
121:
122: <table width="100%" cellspacing="0" cellpadding="0" class="SourceViewHeaderBg" border="0">
123:
124: <tr valign="top">
125: <td>
126:
127: <table cellpadding=5 cellspacing=0 background="grid_background.gif" width="100%">
128: <tr>
129: <td class="TitleBar">
130: <span id="Title" class="SourceViewTitle" runat="server">IBuySpy Portal Source Code Viewer</span>
131: </td>
132: </tr>
133: </table>
134:
135: <asp:Table id="SourceTable" cellpadding="2" cellspacing="2" EnableViewState="true" runat="server"/>
136:
137: </td>
138: </tr>
139:
140: </table>
141:
142: </form>
143: </body>
144: </html>