本文整理匯總了C#中System.IO.FileSystem.IsDirectory方法的典型用法代碼示例。如果您正苦於以下問題:C# FileSystem.IsDirectory方法的具體用法?C# FileSystem.IsDirectory怎麽用?C# FileSystem.IsDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.FileSystem
的用法示例。
在下文中一共展示了FileSystem.IsDirectory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
lblError.Visible = false;
byte[] fileData;
CFile file = new FileSystem(Globals.CurrentIdentity).GetFile(Convert.ToInt32(Request.Params["FileID"]));
string filename= file.Name;
if (file.IsDirectory()) {
fileData = GetDirectoryData(file);
filename += ".zip";
}
else {
try {
new FileSystem(Globals.CurrentIdentity).LoadFileData(file);
} catch (CustomException er) {
PageError(er.Message);
return;
}
fileData = file.RawData;
}
Response.Clear();
Response.ContentType = "application/octet-stream; name=" + filename;
Response.AddHeader("Content-Disposition","attachment; filename=" + filename);
Response.AddHeader("Content-Length", fileData.Length.ToString());
Response.Flush();
Response.OutputStream.Write(fileData, 0, fileData.Length);
Response.Flush();
}
示例2: FileCommand
private void FileCommand(object source, DataGridCommandEventArgs e)
{
CFile file = new FileSystem(Globals.CurrentIdentity).GetFile(
(int)dgFiles.DataKeys[e.Item.ItemIndex]);
if (file.IsDirectory()) {
TreeNode curnode = tvFiles.GetNodeFromIndex(tvFiles.SelectedNodeIndex);
foreach (TreeNode node in curnode.Nodes) {
if (node.NodeData == file.FullPath) {
ExpandTreeNode(node);
ViewState["gridpath"] = node.NodeData;
try {
tvFiles.SelectedNodeIndex = node.GetNodeIndex();
} catch (Exception) {
ExpandTreeNode((TreeNode)node.Parent);
tvFiles.SelectedNodeIndex = node.GetNodeIndex();
}
BindFileGrid();
break;
}
}
}
}