本文整理汇总了C#中FileNode.addChild方法的典型用法代码示例。如果您正苦于以下问题:C# FileNode.addChild方法的具体用法?C# FileNode.addChild怎么用?C# FileNode.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileNode
的用法示例。
在下文中一共展示了FileNode.addChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: read
public override FileNode read(string path, string flags, int offset, int length)
{
Console.WriteLine("path = " + path);
if (path == "")
{
return this.myroot;
}
else
{
string loadPath = sysHomePath + buildWindowsFilePath(path);
if (Directory.Exists(loadPath))
{
Console.WriteLine("loading Directory");
string[] fileEntries = Directory.GetFiles(loadPath);
FileNode tempNode = new FileNode(path, fileTypes.Directory);
foreach (string fileName in fileEntries)
tempNode.addChild(new FileNode(getFileNameFromPath(fileName), fileTypes.Text));
string[] subdirectoryEntries = Directory.GetDirectories(loadPath);
foreach (string subdirectory in subdirectoryEntries)
tempNode.addChild(new FileNode(getFileNameFromPath(subdirectory), fileTypes.Directory));
return tempNode;
}
else if (File.Exists(loadPath))
{
FileNode tempNode = new FileNode(getFileNameFromPath(path), fileTypes.Text);
string filebuffer = File.ReadAllText(loadPath);
tempNode.putData(filebuffer);
return tempNode;
}
else
return null;
}
}
示例2: read
public override FileNode read(string path, string flags, int offset, int length)
{
if (path == "")
return this.myroot;
if (path == "")
{
return this.myroot;
}
else if (getWorkPathArray(path)[1] == "ctl")
{
return null;
}
else if (getWorkPathArray(path)[1] == "new")
{
return null;
}
else if (getWorkPathArray(path)[1] == "contacts")
{
if (xmppManager.contacts.Count == 0)
{
FileNode contactListNode = new FileNode(path, fileTypes.Directory);
return contactListNode;
}
else if(getWorkPathArray(path).Length > 2)
{
if (getWorkPathArray(path).Length == 3)
{
int count = 0;
while (count < xmppManager.contacts.Count && xmppManager.contacts[count].userID != getWorkPathArray(path)[2])
{
count++;
}
//check list for username
if (xmppManager.contacts[count].userID == getWorkPathArray(path)[1])
{
//found it, return ./ctl ./new
FileNode jidNode = new FileNode(getWorkPathArray(path)[1], fileTypes.Directory);
jidNode.addChild(new FileNode("ctl",fileTypes.Text));
jidNode.addChild(new FileNode("new", fileTypes.Text));
return jidNode;
}
//file not found
return null;
}
else
{
int count = 0;
while (count < xmppManager.contacts.Count && xmppManager.contacts[count].userID != getWorkPathArray(path)[1])
{
count++;
}
if (xmppManager.contacts[count].userID == getWorkPathArray(path)[1])
{
FileNode jidNode = new FileNode(getWorkPathArray(path)[1], fileTypes.Directory);
return jidNode;
}
}
}
else
{
FileNode contactListNode = new FileNode(path, fileTypes.Directory);
foreach (contact user in xmppManager.contacts)
{
contactListNode.addChild( new FileNode(user.userID, fileTypes.Directory));
}
return contactListNode;
}
}
else if (getWorkPathArray(path)[1] == "chats")
{
if (xmppManager.chats.Count == 0)
return new FileNode(path,fileTypes.Directory);
else if (getWorkPathArray(path).Length > 2)
{
if (getWorkPathArray(path).Length > 3)
{
if (getWorkPathArray(path).Length == 3)
{
int count = 0;
while (count < xmppManager.chats.Count && xmppManager.chats[count].chatWith.userID != getWorkPathArray(path)[2])
{
count++;
}
//check list for username
if (xmppManager.chats[count].chatWith.userID == getWorkPathArray(path)[2])
{
//found it, return ./ctl ./new
FileNode jidNode = new FileNode(getWorkPathArray(path)[1], fileTypes.Directory);
jidNode.addChild(new FileNode("ctl", fileTypes.Text));
jidNode.addChild(new FileNode("new", fileTypes.Text));
//.........这里部分代码省略.........