C # XML XSL JavaScript combined using a web program imitation Windows Explorer

xiaoxiao2021-03-06  69

The younger brother has written an ASP.NET applet with C #, using some XML and XSL technology,

This application mainly uses ASP.NET applications to simulate a Windows Explorer

One form left is a dynamically loaded folder tree list, and the right side can view the content of some types of files.

This web war uses some pictures, please find in the photo album.

Site Home INDEX.HTM content

Web-based file viewer </ title></p> <p><meta http-equiv = "content-type" content = "text / html; charSet = GB2312"></p> <p></ hEAD></p> <p><frameset cols = "237,767" rows = "*"></p> <p><frame src = "treeciew.aspx"></p> <p><frame name = "frameview" src = "Description .txt"></p> <p></ frameset></p> <p><noframes></p> <p><body bgcolor = "# ffffff" text = "# 000000"></p> <p></ body></p> <p></ NOFRAMES></p> <p></ html></p> <p>Document Description .txt content</p> <p>Web-based file browsing viewer</p> <p>This system is an ASP.NET application, using C # language development</p> <p>This system mimics the file system tree list of Windows Explorer in a browser / server mode</p> <p>And provide a certain type of file view function</p> <p>This system is not a database application system, so it is not necessary to configure any database</p> <p>Copy all files to a virtual directory on a web server to run</p> <p>But the server must install IIS and Microsoft .NET FRAMWORK 1.1 Simplified Chinese version</p> <p>This system default root directory is d: /, but you can modify the root directory when the system is running, or you can enter fileview.aspx.cs</p> <p>The 19th line modifies the default root directory and recompiled it.</p> <p>This system main page is index.htm</p> <p>This system is an ASP.NET application, so the program is running under the ASPNET user account, which is generally relatively low.</p> <p>So if this system cannot view a file directory, you need to enter the relevant system management tool to set the ASPNET permission.</p> <p>Client recommends installing IE6.0 and above</p> <p>************** Copyright Notice********************************** *******************</p> <p>You can freely refer to modify and reference all the code, you can put all the code</p> <p>Unrelated systems are used in any system.</p> <p>But please respect the intellectual property rights during use, I hope that when I have revised it.</p> <p>Please don't tell or delete such an intellectual property statement of poor Baba.</p> <p>Labor results of people who respect the long night to knock on the keyboard</p> <p>Nanjing Yuan Yongfu 2004-8-8</p> <p>YYF9989@hotmail.com</p> <p>*************** document list********************************* *******************</p> <p>bmp.bmp gif.bmp htm.bmp html.bmp</p> <p>JPEG.BMP jpg.bmp txt.bmp new.bmp</p> <p>The icon BMP file used to represent the file type in the tree list, where the document name is</p> <p>Suitable for this icon file extension, default is new.bmp</p> <p>You can add the corresponding file type BMP, all of these BMP size is 16 * 16 pixels</p> <p>Child.gif Close.bmp Collapse.gif Expend.gif</p> <p>Open.bmp line.gif lastchild.gif</p> <p>Picture of manifesting a tree structure in a tree list</p> <p>Index.htm System Home Page, a static HTML page divided into left and right frames FileView.aspx for obtaining file list information and file information and contents ASP.NET page</p> <p>TreeView.aspx ASP.NET page for maintaining a tree list</p> <p>HTMLContent.xml is an XSLT document that generates an HTML code that displays the file content according to file information.</p> <p>Document TreeView.aspx content</p> <p><% @ Page language = "c #" autoeventwireup = "false" inherits = "fileview.treeView"%></p> <p><! ----------------------------------------------------------------------------- -----------------------------</p> <p>Web-based file viewer file tree list</p> <p>This page integrates ASP.NET, XML, XSLT and DHTML technology.</p> <p>This page is used to maintain a list of files, which imitates the file tree list of Windows Explorer.</p> <p>You can freely refer to modifying and reference all of the code, you can use unrestricted systems that are unrestricted in any nature.</p> <p>But please respect the intellectual property rights during use, I hope that when I have revised it.</p> <p>Please don't tell or delete such an intellectual property statement of poor Baba.</p> <p>Nanjing Yuan Yongfu 2004-8-8</p> <p>YYF9989@hotmail.com</p> <p>-------------------------------------------------- ----------------------------></p> <p><%</p> <p>String strpath = this.Request.form ["baseurl"];</p> <p>IF (strPath == null || strpath.trim (). Length == 0)</p> <p>StrPath = fileview.fileView.basepath; // Displays the current root directory</p> <p>strpath = strpath.trim ();</p> <p>IF (strpath.endswith ("//") == false)</p> <p>StrPath = StrPath "//";</p> <p>IF (System.io.Directory.exists (STRPATH))</p> <p>FileView.FileView.basepath = strpath;</p> <p>%></p> <p><Html></p> <p><HEAD></p> <p><Title> Dynamic XML Tree List </ Title></p> <p><style></p> <p>Body {font-family: "Song"; font-size: 12px}</p> <p>.Treenode {font-size: 12px; Cursor: HAND}</p> <p>.FocusNode {Border-Right: # ff0000 1px solid;</p> <p>Border-top: # ff0000 1px solid; font-size: 12px; margin-bottom: -2px;</p> <p>Border-left: # ff0000 1px solid; cursor: hand; color: #fffff;</p> <p>Border-bottom: # ff0000 1px solid; Background-color: # 000099; Text-align: left}</p> <p></ style></p> <p></ HEAD></p> <p><body leftmargin = "1" TopMargin = "1"></p> <p><form id = "form1" method = "post"> <div></p> <p><span id = "maintree" childlist = "fileview.aspx? type = list"> root node</p> <p><Input Type = "text" name = "BaseURL" style = "width: 72" value = "<% = strpath%>" /></p> <p><Input Type = "Submit" Value = "Refresh" /> </ span></p> <p></ div></p> <p></ form></p> <p><! -</p> <p>XML data island, defined here to match the XSLT document,</p> <p>This XSLT document is used to support dynamic generated tree lists</p> <p>-></p> <p><xml id = "treexsl"></p> <p><XSL: Stylesheet XMLns: XSL = "http://www.w3.org/1999/xsl/transform" Version = "1.0"></p> <p><xsl: Output method = "xml" /></p> <p><XSL: Template Match = "/ *"></p> <p><XSL: Variable Name = "BaseURL"></p> <p><xsl: value-of select = "@ BaseURL" /></p> <p></ XSL: Variable></p> <p><table border = "0" width = "100%" cellspacing = "0" cellpadding = "0" id = "createdTable"></p> <p><xsl: for-each select = "*"></p> <p><! - Tree list is sorted by node text -></p> <p><XSL: Sort Select = "Concat (@file, @text)" /></p> <p>Currently calculate the code of the current node -></p> <p><XSL: Variable Name = "NodeID"></p> <p><xsl: choose></p> <p><xsl: when test = "@ id! = ''"></p> <p><XSL: Value-of Select = "Concat ('ID', @ID)" /></p> <p></ xsl: when></p> <p><xsl: when test = "Boolean ('True')"></p> <p><XSL: Value-of SELECT = "Translate (Name (), '.', '_')" /></p> <p></ xsl: when></p> <p></ xsl: choose></p> <p></ XSL: Variable></p> <p><tr></p> <p><TD Valign = "TOP" align = "left" width = "16"></p> <p><xsl: choose></p> <p><xsl: when test = "@ childlist! = ''"> <xsl: if test = "Position ()! = last ()"></p> <p><xsl: attribute name = "background"> ​​line.gif </ xsl: attribute></p> <p></ xsl: if></p> <p><img src = "collapse.gif" eXpend = "0"></p> <p><XSL: Attribute Name = "ID"></p> <p><XSL: Value-of SELECT = "Concat ($ NodeID, 'Expend')" /></p> <p></ xsl: attribute></p> <p><xsl: attribute name = "onclick"> expENDNODEBYID ('<xsl: value-of select = "$ nodeid" />'); </ xsl: attribute></p> <p></ img></p> <p></ xsl: when></p> <p><xsl: when test = "Boolean ('True')"></p> <p><xsl: if test = "position ()! = last ()"></p> <p><img src = "child.gif" /></p> <p></ xsl: if></p> <p><xsl: if test = "position () = Last ()"></p> <p><img src = "lastchild.gif" /></p> <p></ xsl: if></p> <p></ xsl: when></p> <p></ xsl: choose></p> <p></ td></p> <p><TD Valign = "TOP" nowRAP = "1"></p> <p><! -</p> <p>Icon HTML code for generating a tree list</p> <p>-></p> <p><img align = "absmiddle" οnclick = "expendnode (this.nextsibling)" width = "16" height = "16"></p> <p><XSL: Attribute Name = "ID"></p> <p><XSL: Value-of SELECT = "Concat ($ NodeID, 'icon')" /></p> <p></ xsl: attribute></p> <p><XSL: Attribute Name = "SRC"></p> <p><xsl: choose></p> <p><XSL: WHEN TEST = "@ IMG! = ''"></p> <p><XSL: Value-of Select = "@ img" /></p> <p></ xsl: when></p> <p><xsl: when test = "@ childlist! = ''"> close.bmp </ xsl: when></p> <p><XSL: WHEN TEST = "Boolean ('True')> Default.bmp </ xsl: by></p> <p></ xsl: choose> </ xsl: attribute></p> <p></ img></p> <p><! - Generate Tree List Node Text -></p> <p><a class="treenode" valign="top" οnclick="expendnode(this "" target="frameview"></p> <p><XSL: Attribute Name = "ID"></p> <p><XSL: Value-of SELECT = "$ NodeID" /></p> <p></ xsl: attribute></p> <p><XSL: if Test = "@ href! = ''"></p> <p><XSL: Attribute Name = "HREF"></p> <p><XSL: Value-of SELECT = "Concat ($ BASEURL, @HREF)" /></p> <p></ xsl: attribute></p> <p></ xsl: if></p> <p><xsl: if test = "@childlist! = ''"></p> <p><xsl: attribute name = "childlist"></p> <p><XSL: Value-of Select = "@ childlist" /></p> <p></ xsl: attribute></p> <p><XSL: Attribute Name = "HREF"></p> <p><XSL: Value-of SELECT = "Concat ($ BASEURL, @ChildList" /></p> <p></ xsl: attribute></p> <p></ xsl: if></p> <p><XSL: Value-of SELECT = "Concat ('', @ Text)" /></p> <p></a></p> <p></ td></p> <p></ TR></p> <p></ xsl: for-energy></p> <p></ TABLE></p> <p></ xsl: template></p> <p></ xsl: stylesheet></p> <p></ xml></p> <p><script language = "javascript"></p> <p><! -</p> <p>VAR CURRENTTREENODE; / / Define the current node object of the tree list</p> <p>Var intIDCount = 1234; // Defines an ID number initial value</p> <p>VAR CurrentLoadingId = ""</p> <p>// Initialize the XSLT template</p> <p>Var xsldoc = New ActiveXObject ("msxml.domdocument");</p> <p>xsldoc.async = false;</p> <p>XSLDoc.Load (treexsl.xmldocument);</p> <p>Var ResultDoc = New ActiveXObject ("msxml.domdocument");</p> <p>Resultdoc.onreadyStateChange = XmlStateChange;</p> <p>Resultdoc.async = true;</p> <p>Function XMLStateChange ()</p> <p>{</p> <p>//Window.status = resultdoc.readyState; if (Resultdoc.ReadyState == 4)</p> <p>{</p> <p>Var objlabel = document.getlementByid ("LoadFlag" intIDCount);</p> <p>if (Resultdoc.Parseerror.Errorcode! = 0)</p> <p>Objlabel.innertext = "load error:" resultdoc.parseerror.reason;</p> <p>Else</p> <p>{</p> <p>Var myobj = document.getlementByid (CurrentLoadingID "Expend"); // Get a node's expansion point picture object</p> <p>Var myicon = document.getlementByid (CurrentLoadingID "icon"); // Get the icon object of the node</p> <p>Var mainobj = document.getlementByid (currentloadingID); // Get the text object of the node</p> <p>Var myTable;</p> <p>Var strHtml = resultdoc.transformNode (xsldoc);</p> <p>WINDOW.STATUS = "Load is complete, generating sub-node list ...";</p> <p>Mainobj.insertadjacenthtml ("Afterend", strHtml;</p> <p>Mainobj.Removettribute ("childlist");</p> <p>/ / Get initialized child node table objects and initialize</p> <p>MyTable = Document.getlementByid ("createdTable");</p> <p>Objlabel.style.display = "none";</p> <p>IF (MyTable! = NULL)</p> <p>{</p> <p>MyTable.style.display = "";</p> <p>MyTable.id = CurrentLoadingID "Table";</p> <p>}</p> <p>IntidCount ;</p> <p>//mytable.style.display="none;</p> <p>IF (MyObj! = null)</p> <p>{</p> <p>MyTable.style.display = "";</p> <p>myobj.expend = "1";</p> <p>myobj.src = "expend.gif";</p> <p>Myicon.src = "open.bmp";</p> <p>Myicon.align = "absmiddle";</p> <p>}</p> <p>WINDOW.STATUS = ""</p> <p>}</p> <p>}</p> <p>}</p> <p>/ / Expand a tree list node and set to the current node</p> <p>Function ExpendnotNode (OBJ)</p> <p>{</p> <p>IF (CurrentTreenode! = Obj && Currenttreenode! = NULL)</p> <p>{</p> <p>Currenttreenode.className = "Treenode";</p> <p>}</p> <p>Currenttreenode = OBJ;</p> <p>Currenttreenode.className = "focusnode";</p> <p>WINDOW.STATUS = Obj.innertext;</p> <p>ExpendnotNodebyid (Obj.id);</p> <p>// Expand the node of the specified number of tree list, if the child node of the node is not loaded, loaded</p> <p>Function ExpendnotNodebyid (Strid)</p> <p>{</p> <p>Var myobj = document.getlementByid (Strid "Expend"); // Get the expansion point picture object of the node</p> <p>Var myicon = document.getlementByid (Strid "icon"); // Get the icon object of the node</p> <p>Var mainobj = document.getlementById (strike); // Get text objects for nodes</p> <p>Var myTable;</p> <p>MyTable = Document.getlementByid (Strid "Table"); // Get sub-node form</p> <p>IF (mainobj! = null && mainobj.childlist! = null && mytable == null)</p> <p>{</p> <p>// Add a child node</p> <p>Mainobj.insertadjacenthtml ("Afterend",</p> <p>"<div id = 'loadflag" intidcount "> is adding subtitle ... </ div>");</p> <p>WINDOW.STATUS = "The child node" " " mainobj.innertext "is loading."</p> <p>CurrentLoadingId = StrId;</p> <p>Resultdoc.Load (Mainobj.childlist);</p> <p>Return;</p> <p>}</p> <p>// Expand or shrink the subpost</p> <p>IF (mainobj! = null && myobj! = null && myTable! = null)</p> <p>{</p> <p>IF (myobj.expend == "1")</p> <p>{</p> <p>MyTable.style.display = "none";</p> <p>Myobj.expend = "0";</p> <p>Myobj.src = "collapse.gif";</p> <p>Myicon.src = "close.bmp";</p> <p>Myicon.align = "absmiddle";</p> <p>}</p> <p>Else</p> <p>{</p> <p>MyTable.style.display = "";</p> <p>myobj.expend = "1";</p> <p>myobj.src = "expend.gif";</p> <p>Myicon.src = "open.bmp";</p> <p>Myicon.align = "absmiddle";</p> <p>}</p> <p>WINDOW.STATUS = "folder:" Mainobj.innertext "Candid Subpoint" MyTable.Rows.Length ""</p> <p>}</p> <p>}</p> <p>// Add root node when loading</p> <p>ExpendnotNodebyid ("Maintree");</p> <p>//document.getlementByid ("Maintree" ".innertext = "root node"; -></p> <p></ script></p> <p></ body></p> <p></ Html></p> <p>File FileView.aspx This page's HTML code is only <% @ page language = "c #" codebehind = "fileview.aspx.cs" autoeventwireup = "false" inherits = "fileview.fileView"%> Its CS source code is</p> <p>Using system;</p> <p>Using system.collections;</p> <p>Using system.componentmodel;</p> <p>Using system.data;</p> <p>Using system.drawing;</p> <p>Using system.Web;</p> <p>Using system.Web.SessionState;</p> <p>Using system.Web.ui;</p> <p>Using system.Web.ui.webcontrols;</p> <p>Using system.Web.ui.htmlcontrols;</p> <p>Namespace fileview</p> <p>{</p> <p>/// <summary></p> <p>/// Return to a list of files, single file information, and files all content</p> <p>///</p> <p>/// You can any reference to all code to modify and reference all code, you can use unrestricted systems that are used in any nature.</p> <p>///</p> <p>/ / / But please respect the intellectual property rights during use, I hope that when I have modified it.</p> <p>///</p> <p>// / Do not tamper or delete such an intellectual property statement of poor Baba</p> <p>///</p> <p>/// Nanjing Yuan Yongfu 2004-8-8</p> <p>/// YYF9989@hotmail.com</p> <p>/// </ summary></p> <p>Public class fileview: system.web.ui.page</p> <p>{</p> <p>Private static string c_basepath = "d: //"; // Initialization folder path</p> <p>Private const string c_list = "list"; // Returns the parameters of the file list</p> <p>Private const string c_get = "get"; // Get parameters for file information</p> <p>Private const string c_getfile = "getfile"; // Get parameters for file content</p> <p>Private const string c_preview = "preview"; // Get the preview result of the picture</p> <p>Private static string str refviewtype = "list";</p> <p>// Type list of document content</p> <p>Private static system.collections.specialized.namevalueCollection mycontenttypelist = null;</p> <p>/ / Save the list of full path names for files and directories</p> <p>Static system.collections.ArrayList myfilelist = new arraylist ();</p> <p>/// <summary></p> <p>/// Setting, return to initialization root directory</p> <p>/// </ summary></p> <p>Public Static String Basepath</p> <p>{</p> <p>Get {returnif c_basepath;}</p> <p>set</p> <p>{</p> <p>C_BasePath = Value;</p> <p>MyFileList.clear ();</p> <p>}</p> <p>Private Void Page_Load (Object Sender, System.EventArgs E)</p> <p>{</p> <p>/ / Place the user code here to initialize the page</p> <p>String strpath = NULL;</p> <p>String straType = NULL;</p> <p>// Initialization document type list</p> <p>IF (MyContentTypelist == NULL)</p> <p>{</p> <p>MyContentTypelist = new system.collections.specialized.namevalueCollection ();</p> <p>MyContentTypelist.Add ("JS", "Text");</p> <p>MyContentTypelist.Add ("JSP", "Text");</p> <p>MyContentTypelist.Add ("ASP", "Text");</p> <p>MyContentTypelist.Add ("TXT", "Text");</p> <p>MyContentTypelist.Add ("CPP", "Text");</p> <p>MyContentTypelist.Add ("C", "Text");</p> <p>MyContentTypelist.Add ("H", "Text");</p> <p>MyContentTypelist.Add ("frm", "text");</p> <p>MyContentTypelist.Add ("SQL", "Text");</p> <p>MyContentTypelist.Add ("CS", "text");</p> <p>MyContentTypelist.Add ("VB", "Text");</p> <p>MyContentTypelist.Add ("CLS", "text");</p> <p>MyContentTypelist.Add ("Java", "Text");</p> <p>MyContentTypelist.Add ("ini", "text");</p> <p>MyContentTypelist.Add ("resx", "text / xml");</p> <p>MyContentTypelist.Add ("XML", "Text / XML");</p> <p>MyContentTypelist.Add ("XSD", "Text / XML");</p> <p>MyContentTypelist.Add ("XSL", "Text / XML");</p> <p>MyContentTypelist.Add ("BMP", "Image / BMP");</p> <p>MyContentTypelist.Add ("JPG", "Image / JPEG");</p> <p>MyContentTypelist.Add ("JPEG", "Image / JPEG");</p> <p>MyContentTypelist.Add ("TIFF", "Image / Tiff");</p> <p>MyContentTypelist.Add ("PNG", "Image / PNG"); MyContentTypelist.Add ("GIF", "Image / GIF");</p> <p>MyContentTypelist.Add ("ICO", "Image / X-icon");</p> <p>MyContentTypelist.Add ("DOC", "Application / Msword");</p> <p>MyContentTypelist.Add ("XLS", "Application / X-msexcel");</p> <p>MyContentTypelist.Add ("PPT", "Application / X-MspowerPoint");</p> <p>MyContentTypelist.Add ("Zip", "Application / X-Zip-compressed");</p> <p>}</p> <p>// Analyze parameters, get object numbers and parameter types</p> <p>IF (this.Request ["ViewType"]! = null)</p> <p>{</p> <p>StrviewType = this.Request ["ViewType"];</p> <p>Return;</p> <p>}</p> <p>INDEX = TOINT32VALUE (this.Request ["id"], - 1);</p> <p>Strtype = this.Request ["type"];</p> <p>IF (c_list == stroyal)</p> <p>{</p> <p>// Get a list of files</p> <p>IF (Index <0 || index> myfilelist.count - 1)</p> <p>{</p> <p>MyFileList.clear ();</p> <p>StrPath = c_basepath;</p> <p>}</p> <p>Else</p> <p>{</p> <p>StrPath = (string) MyFileList [index];</p> <p>}</p> <p>/ / Generate an XML document list of a list of descriptors</p> <p>System.xml.xmldocument mydoc = new system.xml.xmldocument ();</p> <p>MyDoc.loadxml ("<filelist />");</p> <p>MyDoc.documentelement.settribute ("text", system.io.path.getFileName (StrPath));</p> <p>MyDoc.documentelement.setttribute ("ViewType", StrviewType);</p> <p>IF ((System.IO.File.GetaTributes (strpath) & system.io.fileAttributes.directory! = 0)</p> <p>{</p> <p>String [] strfiles = system.io.directory.GetFileSystemNuthTries (strpath, "*. *");</p> <p>For (int icount = 0; icount <strfiles.length; iCount )</p> <p>{</p> <p>System.xml.xmlelement myelement = mydoc.createElement ("file");</p> <p>MyDoc.documentelement.appendchild (myelement);</p> <p>Try</p> <p>{</p> <p>MyElement.setttribute ("text", system.io.path.getFileName (Strfiles [iCount])); MyElement.setttribute ("id", myfilelist.count.tostring ());</p> <p>IF ((STRFILES [ICOUNT) & System.IO.FileAttributes.directory) == 0)</p> <p>{</p> <p>// This path is a file</p> <p>String strfileext = system.io.path.Getextension (strfiles [iCount]);</p> <p>IF (StrfileExt! = null && strfileext.length> 0)</p> <p>{</p> <p>StrfileExt = strfileext.substring (1);</p> <p>StrfileExt = strfileext.trim ();</p> <p>// Set the icon of the file</p> <p>IF (strfileext == "iCO")</p> <p>MyElement.setttribute ("img", "fileview.aspx? type = getfile =" myfilelist.count.toString ());</p> <p>Else</p> <p>{</p> <p>IF (System.IO.FILE.EXISTS (this.mappath (") " // " StrfileExt " .bmp "))</p> <p>MyElement.setttribute ("IMG", StrfileExt ".bmp");</p> <p>}</p> <p>MyElement.setttribute ("Type", StrfileExt;</p> <p>}</p> <p>/ / Set the tree list link URL</p> <p>// If you are displayed directly, it is displayed directly, otherwise you will use XSL format.</p> <p>String strcontenttype = myContentTypelist.get (StrfileExt.tolower ());</p> <p>IF (strContentType! = NULL</p> <p>&& ("Image /") || StrContentType.StartSwith ("Text"))))</p> <p>{</p> <p>MyElement.setttribute ("href", "fileview.aspx? type = getfile" myfilelist.count.toString ());</p> <p>IF (strcontenttype.startswith ("image /"))</p> <p>MyElement.setttribute ("IMGFILE", "1");</p> <p>}</p> <p>Else</p> <p>MyElement.setttribute ("href", "fileview.aspx? id =" myfilelist.count.toString ());</p> <p>MyElement.setttribute ("File", "1");</p> <p>MyElement.setttribute ("size", (new system.io.fileinfo (Strfiles [iCount])). Length.toString ());</p> <p>}</p> <p>Else</p> <p>{</p> <p>// This path is a directory</p> <p>MyElement.setttribute ("Childlist", "FileView.aspx? type = list & id =" myfilelist.count.tostring ()); myelement.setttribute ("file", "0");</p> <p>}</p> <p>System.datetime DTMDATE = system.io.file.getlastaccesstime (Strfiles [iCount]);</p> <p>MyElement.setttribute ("Accesstime", DTMDATE.TOSTRING ("YYYY-MM-DD HH: MM: SS"));</p> <p>/ / Add a project to the object path list</p> <p>myfilelist.add (strfiles [iCount]);</p> <p>}</p> <p>Catch (Exception EXT)</p> <p>{</p> <p>MyElement.setttribute ("Text", "Error:" ext.Message);</p> <p>Break;</p> <p>}</p> <p>}</p> <p>}</p> <p>// Output file list document</p> <p>THIS.RESPONSE.CONTENTENCODING = system.text.Encoding.Getencoding (936);</p> <p>THIS.RESPONSE.WRITE ("<? XML Version = /" 1.0 / "encoding = /" gb2312 / "?> <? Xml-stylesheet type = /" text / xsl / "href = /" htmlcontent.xml / "? > ");</p> <p>This.Response.write (MyDoc.documentelement.outerxml);</p> <p>//mydoc.save (this.Response.output);</p> <p>}</p> <p>ELSE IF (c_getfile == stroyal)</p> <p>{// return file content</p> <p>IF (INDEX> = 0 && index <myfilelist.count)</p> <p>{</p> <p>String strfile = (string) MyFileList [index];</p> <p>IF ((System.IO.File.GetaTributes & System.io.fileAttributes.directory) == 0)</p> <p>{</p> <p>IF (System.IO.File.exists (Strfile))</p> <p>{</p> <p>String strfileext = getfileextension (strfile);</p> <p>String strcontenttype = myContentTypelist.get (strfileext);</p> <p>IF (this.Request ["preview"]! = null)</p> <p>{</p> <p>IF (strcontenttype.startswith ("image /"))</p> <p>{</p> <p>Using (System.drawing.Image MyImg = System.drawing.Image.FromFile (Strfile))</p> <p>{</p> <p>IF (MyImg.Width <100)</p> <p>This.Response.writefile (STRFILE);</p> <p>Else</p> <p>{</p> <p>System.drawing.Image preimg = myimg.getthumbnailImage (100, 100, null, system.intptr.zero);</p> <p>Preimg.save (this.Response.OutputStream, System.drawing.Imaging.imageFormat.jpeg); preImg.dispose ();</p> <p>}</p> <p>}</p> <p>}</p> <p>Return;</p> <p>}</p> <p>Else</p> <p>{</p> <p>IF (strContentType == Null || strcontenttype.length == 0)</p> <p>This.Response.writefile (STRFILE);</p> <p>Else</p> <p>{</p> <p>IF (strContentType == "text")</p> <p>{</p> <p>THIS.RESPONSE.CONTENTENCODING = system.text.Encoding.Getencoding (936);</p> <p>This.Response.contenttype = "text / html";</p> <p>This.Response.write ("<pre>");</p> <p>This.Response.writefile (STRFILE);</p> <p>This.Response.write ("</ pre>");</p> <p>Return;</p> <p>}</p> <p>Else</p> <p>{</p> <p>This.Response.contenttype = strcontenttype;</p> <p>This.Response.writefile (STRFILE);</p> <p>}</p> <p>}</p> <p>}</p> <p>}</p> <p>}</p> <p>}</p> <p>}</p> <p>Else IF (c_preview == startpe)</p> <p>{</p> <p>}</p> <p>Else</p> <p>{</p> <p>// Return to file information</p> <p>IF (INDEX> = 0 && index <myfilelist.count)</p> <p>{</p> <p>System.xml.xmldocument mydoc = new system.xml.xmldocument ();</p> <p>MyDoc.loadxml ("<file />");</p> <p>MyDoc.documentelement.settribute ("type", getfileextension (string) MyFileList [index]))</p> <p>MyDoc.documentelement.setattribute ("URL", "FileView.aspx? type = getfile =" index.toString ());</p> <p>THIS.RESPONSE.WRITE ("<? XML Version = /" 1.0 / "encoding = /" gb2312 / "?> <? Xml-stylesheet type = /" text / xsl / "href = /" htmlcontent.xml / "? > ");</p> <p>This.Response.write (MyDoc.documentelement.outerxml);</p> <p>}</p> <p>}</p> <p>}</p> <p>/// <summary></p> <p>/// obtain a file extension according to the path</p> <p>/// </ summary></p> <p>/// <param name = "strfile"> file path </ param></p> <p>/// <returns> file extension, if there is no extension, return blank string </ returns></p> <p>Private string getfileextension (String Strfile)</p> <p>{</p> <p>Try</p> <p>{</p> <p>String strfileext = system.io.path.Getextension (strfile);</p> <p>StrfileExt = strfileext.substring (1) .trim (). TOLOWER (); Return StrfileExT;</p> <p>}</p> <p>Catch</p> <p>{</p> <p>""; "</p> <p>}</p> <p>}</p> <p>/// <summary></p> <p>/// Convert the string into an integer, return to the default value if the conversion fails</p> <p>/// </ summary></p> <p>/// <param name = "strdata"> string </ param></p> <p>/// <param name = "defaultValue"> Default </ param></p> <p>/// <returns> Conversion Results </ returns></p> <p>Private int toint32value (String strdata, int defaultValue)</p> <p>{</p> <p>Try</p> <p>{</p> <p>IF (strData == null)</p> <p>Return DefaultValue;</p> <p>Else</p> <p>Return Convert.TOINT32 (STRDATA);</p> <p>}</p> <p>Catch</p> <p>{</p> <p>Return DefaultValue;</p> <p>}</p> <p>}</p> <p>#Region web form designer generated code</p> <p>Override protected void oninit (Eventargs E)</p> <p>{</p> <p>//</p> <p>// Codegen: This call is necessary for the ASP.NET Web Form Designer.</p> <p>//</p> <p>InitializationComponent ();</p> <p>Base.onit (E);</p> <p>}</p> <p>/// <summary></p> <p>/// Designer supports the required method - do not use the code editor to modify</p> <p>/// This method is content.</p> <p>/// </ summary></p> <p>Private vidinitiRizeComponent ()</p> <p>{</p> <p>This.Load = New System.EventHandler (this.page_load);</p> <p>}</p> <p>#ndregion</p> <p>}</p> <p>}</p> <p>Document HTMLCONTENT.XML content</p> <p><? XML Version = "1.0" encoding = "UTF-8"?></p> <p><XSL: Stylesheet XMLns: XSL = "http://www.w3.org/1999/xsl/transform" Version = "1.0"></p> <p><! -</p> <p>Used to process the XML file describing the single file information, generate an HTML page code that actually displays the document</p> <p>You can freely refer to modifying and reference all of the code, you can use unrestricted systems that are unrestricted in any nature.</p> <p>But please respect the intellectual property rights during use, I hope that when I have revised it.</p> <p>Please don't tell or delete such an intellectual property statement of poor Baba.</p> <p>Nanjing Yuan Yongfu 2004-8-8</p> <p>YYF9989@hotmail.com</p> <p>-></p> <p><XSL: Output method = "html" /></p> <p><XSL: Template Match = "/ *"></p> <p><xsl: choose></p> <p><XSL: WHEN TEST = "Name (.) = 'filelist'></p> <p><html></p> <p><HEAD></p> <p><title> File list </ title></p> <p></ hEAD></p> <p><body leftmargin = "1" TopMargin = "1"></p> <p><XSL: Value-of Select = "Concat ('folder', @text, 'Subject list", count (*),' subjects') "/> [<a href =" fileview.aspx? ViewType = List> Settings list view mode </a>]</p> <p>[<a href="fileView.aspx?viewtype=preview"> Set preview view mode </a>]</p> <p><br /></p> <p><xsl: if test = "@viewtype = 'preview'"></p> <p><xsl: for-each select = "* [@ imgfile = '1']>></p> <p><a></p> <p><XSL: Attribute Name = "HREF"></p> <p><XSL: Value-of SELECT = "@ href" /></p> <p></ xsl: attribute></p> <p><IMG></p> <p><XSL: Attribute Name = "SRC"></p> <p><XSL: Value-of Select = "Concat (@HREF, '& Preview = 1')" /></p> <p></ xsl: attribute></p> <p><XSL: Attribute Name = "Alt"></p> <p><XSL: Value-of SELECT = "@ text" /></p> <p></ xsl: attribute></p> <p></ img></p> <p></a></p> <p></ xsl: for-energy></p> <p></ xsl: if></p> <p><xsl: if test = "@ viewtype = 'list'"></p> <p><table width = "100%" cellspacing = "0" rules = "all" bordercolor = "# cc0066" border = "1" id = "lvwtable"</p> <p>Style = "Border-Color: # cc0066; width: 100%; Border-Collapse: Collapse; Z-Index: 101; Left: 40px; font-family: Song; Font-Size: 12px"></p> <p><tr style = "Background-color: #ccccff;">></p> <p><TD> file name </ td></p> <p><TD> Size </ TD></p> <p><TD> Type </ TD></p> <p><TD> Modification time </ td></p> <p></ TR></p> <p><xsl: for-each select = "*"></p> <p>Currently calculate the code of the current node -></p> <p><XSL: Variable Name = "NodeID"></p> <p><xsl: choose></p> <p><xsl: when test = "@ id! = ''"></p> <p><XSL: Value-of SELECT = "Concat ('ID', @ID)" /> </ xsl: when></p> <p><xsl: when test = "Boolean ('True')"></p> <p><XSL: Value-of SELECT = "Translate (Name (), '.', '_')" /></p> <p></ xsl: when></p> <p></ xsl: choose></p> <p></ XSL: Variable></p> <p><tr></p> <p><TD></p> <p><img id = "img1" align = "absmiddle" width = "16" height = "16"></p> <p><XSL: Attribute Name = "SRC"></p> <p><xsl: choose></p> <p><XSL: WHEN TEST = "@ IMG! = ''"></p> <p><XSL: Value-of Select = "@ img" /></p> <p></ xsl: when></p> <p><xsl: when test = "@ childlist! = ''"> close.bmp </ xsl: when></p> <p><XSL: WHEN TEST = "Boolean ('True')> Default.bmp </ xsl: by></p> <p></ xsl: choose></p> <p></ xsl: attribute></p> <p></ img></p> <p><! - Generate Tree List Node Text -></p> <p><a class="troenode" valign="top"></p> <p><XSL: if Test = "@ href! = ''"></p> <p><XSL: Attribute Name = "HREF"></p> <p><XSL: Value-of SELECT = "@ href" /></p> <p></ xsl: attribute></p> <p></ xsl: if></p> <p><XSL: Value-of SELECT = "Concat ('', @ Text)" /></p> <p></a></p> <p></ td></p> <p><TD></p> <p><XSL: Value-of Select = "@ size" /></p> <p></ td></p> <p><TD></p> <p><xsl: value-of select = "@ Type" /></p> <p></ td></p> <p><TD></p> <p><XSL: Value-of Select = "@ accesstime" /></p> <p></ td></p> <p></ TR></p> <p></ xsl: for-energy></p> <p></ TABLE></p> <p></ xsl: if></p> <p></ body></p> <p></ html></p> <p></ xsl: when></p> <p><XSL: WHEN TEST = "@ type = 'swf'"></p> <p><! - Flash animation, you need to call Flash Player -> <HTML></p> <p><head> </ hEAD></p> <p><body></p> <p><DIV></p> <p>This document is a flash animation, will play with FALSH animation player</p> <p><br /> Please confirm your computer system installed Flash animation player</p> <p></ div></p> <p><Object classid = "CLSID: D27CDB6E-AE6D-11CF-96B8-444553540000" Codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5, 0, 0, 0 "></p> <p><param name = "movie"></p> <p><xsl: attribute name = "value"></p> <p><xsl: value-of select = "@ URL" /></p> <p></ xsl: attribute></p> <p></ param></p> <p><param name = "Quality" value = "high" /></p> <p><Embed Quality = "HIGH" Pluginspage = "http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash"</p> <p>TYPE = "Application / X-ShockWave-Flash"></p> <p><XSL: Attribute Name = "SRC"></p> <p><xsl: value-of select = "@ URL" /></p> <p></ xsl: attribute></p> <p></ Embed></p> <p></ Object></p> <p></ body></p> <p></ html></p> <p></ xsl: when></p> <p><! - image -></p> <p><XSL: WHEN TEST = "@ type = 'jpg' or @ type = 'jpeg' or @ type = 'png' or @ type = 'gif' or @ type = 'icon' @ @ TYPE = 'ICO'>></p> <p><html></p> <p><head> </ hEAD></p> <p><body leftmargin = "1" TopMargin = "1" bgcolor = "# 000000"></p> <p><div align = "center"></p> <p><img border = "1" align = "center" style = "border-color: # ff0000"></p> <p><XSL: Attribute Name = "SRC"></p> <p><xsl: value-of select = "@ URL" /></p> <p></ xsl: attribute></p> <p></ img></p> <p></ div></p> <p></ body></p> <p></ html></p> <p></ xsl: when></p> <p><! -</p> <p>Video or audio documentation, you need to call Windows Media Players</p> <p>The following code is debugged on Windows2000 system installed on Windows Media Player 9</p> <p>-></p> <p><! - xsl: when test = "@ type = 'mpg' or @ type = 'mpge' or @ type = 'avi' or @ type = 'asf' @ type = 'WMV 'or @ type =' mpga 'or @ type =' wma '-></p> <p><XSL: WHEN TEST = "@ Type! = '' and contacts ('. Cda.Aif.Aifc.Aiff.ASF.ASX.wax.wm.wma.wmd.wmp.wmv.wmx.wpl.wvx.avi. WAV.WMZ.MPGA.MPEG.MPG.M1V.MP2.MPA.MPEMP2V.MPV2.MID.MIDI.RMI.AU.MP3.M3U.VOB ', CONCAT ('. ', @ type)) "></p> <p><html></p> <p><head> </ hEAD></p> <p><body></p> <p><DIV></p> <p>The current document is an audio or video file, will play with Windows Media Player to play</p> <p><br /> Use Windows Media Player 9 to play,</p> <p><br /> Make sure you have Windows Media Player 9 on your computer system.</p> <p><br /> The currently supported file extensions include</p> <p><br /> .cda .aif .aifc .aiff .asf .asx .wax .wm .wma .wmd .wmp .wmv .wmx</p> <p><br /> .wpl .wvx .avi .wav .wmz .mpga .mpeg .mpg .m1v .mp2 .mpa .mpemp2v</p> <p><br /> .mpv2 .mid .midi .rmi .au .mp3 .m3u .vob</p> <p></ div></p> <p><Object classid = "CLSID: 6BF52A52-394A-11D3-B153-00C04F79FAA6" ID = "WindowsMediaPlayer1" width = "419"</p> <p>HEIGHT = "242"></p> <p><param name = "URL"></p> <p><xsl: attribute name = "value"></p> <p><xsl: value-of select = "@ URL" /></p> <p></ xsl: attribute></p> <p></ param></p> <p></ Object></p> <p></ body></p> <p></ html></p> <p></ xsl: when></p> <p><! - xsl: when test = "@ type = 'txt'"></p> <p><html></p> <p><HEAD></p> <p></ hEAD></p> <p><body></p> <p><pre ID = "txtpre"></p> <p><script language = "VBScript"> DIM TXTDATA</p> <p>Set txtdata = creteObject ("Microsoft.xmlhttp")</p> <p>TXTDATA.Open "get", "<xsl: value-of select =" @ URL "/>", FALSE</p> <p>TXTDATA.SEND ""</p> <p>Alert txtdata.responsetext</p> <p>Document.getlementByid ("txtpre"). Innerhtml = txtdata.responsetext</p> <p>Set txtdata = Nothing</p> <p></ script></p> <p></ pre></p> <p></ body></p> <p></ html></p> <p></ xsl: by -></p> <p><! - Use the JavaScript script to use the JavaScript script for all other files -></p> <p><xsl: when test = "Boolean ('True')"></p> <p><script language = "javascript"></p> <p>Document.location = "<xsl: value-of select =" @ URL "/>";</p> <p></ script></p> <p></ xsl: when></p> <p></ xsl: choose></p> <p></ xsl: template></p> <p></ xsl: stylesheet></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-119872.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="119872" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.040</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'qz9j9YqEwMG9BvDvTMLmeFnG0_2BV7r4SGl_2BAb4LNRgf7IKVUvhYoCVMcELrupAf3EFXUCQSjsZjvEyFBZ'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>