📄 directorynode.cs
字号:
namespace FTP.Model.DataStructures.DirectoryCache
{
using System.Net;
public class DirectoryNode
{
public string fullDirectoryPath;
public string directoryName;
public ServerFileData[] fileData;
public DirectoryNode[] subNodes;
public bool fullyPopulated = false;
// Constructor with just folder name
public DirectoryNode (string pDirectoryName, string pFullDirectoryPath)
{
this.directoryName = pDirectoryName;
this.fullDirectoryPath = pFullDirectoryPath;
}
public void AddFilesAndCreateSubNodes(ServerFileData[] pServerFileData)
{
this.fileData = pServerFileData;
string parentDirectory = this.fullDirectoryPath;
if (parentDirectory == "/") parentDirectory = "";
// Look for folders in ServerFileData
int subFolderCount = 0;
string[] subFolders = new string[pServerFileData.Length];
for (int i=0; i<pServerFileData.Length; i++)
{
if (pServerFileData[i].isDirectory)
{
subFolders[subFolderCount] = pServerFileData[i].fileName;
subFolderCount++;
}
}
// If there any folders in the Server Data then create sub-nodes
this.subNodes = new DirectoryNode[subFolderCount];
if (subFolderCount > 0)
{
for (int i=0; i<subFolderCount; i++)
{
this.subNodes[i] = new DirectoryNode(subFolders[i], parentDirectory + '/' + subFolders[i]);
}
}
this.fullyPopulated = true;
}
public void flushData()
{
this.fileData = null;
this.subNodes = null;
this.fullyPopulated = false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -