1. display the drive list: // call the static method of directory getlogicaldrives
String [] mydirve = directory. getlogicaldrives;
2. Directory and file list display:
Directory mydir = new directory ();
Directory [] subdir = mydir. getdirectories ();
File [] thisfile = mydir. getfiles ();
3. /// <summary>
/// Used to preview the first 255 characters of a text file
/// </Summary>
Public static string previewfile (string funpath)
{
Streamreader myrd = file. opentext (funpath );
Char [] charbuffer = new char [255];
Int Iread = myrd. readblock (charbuffer, 0,255 );
Return (new string (charbuffer, 0, Iread ));
}
4. ///
/// return the HTML format string of the directory list, used to display the directory list in htlm
///
Public static string getsubdirlist (string strpath, int ilevel)
{< br> string strdirlist_out = "
";
string [] strdirs = directory. getdirectories (strpath);
for (INT I = 0; I
{< br> strdirlist_out + = new string ('', ilevel * 2);
strdirlist_out + =" | __";
strdirlist_out + = strdirs [I] + "/R/N";
strdirlist_out + = getsubdirlist (strdirs [I], ilevel + 1 );
}< br> strdirlist_out + = "
";
return strdirlist_out;
}