当前位置: 首页>>代码示例>>C#>>正文


C# FileNode.putData方法代码示例

本文整理汇总了C#中FileNode.putData方法的典型用法代码示例。如果您正苦于以下问题:C# FileNode.putData方法的具体用法?C# FileNode.putData怎么用?C# FileNode.putData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileNode的用法示例。


在下文中一共展示了FileNode.putData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: read

 public override FileNode read(string path, string flags, int offset, int length)
 {
     if(path == "")
     {
         return this.myroot;
     }
     else if (getWorkPathArray(path)[1] == "time")
     {
         FileNode timeNode = new FileNode(getNewfileName(path), fileTypes.Text);
         timeNode.putData(DateTime.Now.ToLongTimeString());
         return timeNode;
     }
     else if (getWorkPathArray(path)[1] == "date")
     {
         FileNode dateNode = new FileNode(getNewfileName(path), fileTypes.Text);
         dateNode.putData(DateTime.Now.ToLongDateString());
         return dateNode;
     }
     else
         return null;
 }
开发者ID:Softsurve,项目名称:Silver-Iodide,代码行数:21,代码来源:TimeFS.cs

示例2: 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;
        }
    }
开发者ID:Softsurve,项目名称:Silver-Iodide,代码行数:40,代码来源:HomeFS.cs

示例3: read


//.........这里部分代码省略.........
        {
            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));

                            return jidNode;
                        }
                    }
                    if (getWorkPathArray(path).Length == 4)
                    {
                        Console.WriteLine("here i am"+ getWorkPathArray(path)[3]);
                        int count = 0;

                        while (count < xmppManager.chats.Count && xmppManager.chats[count].chatWith.userID != getWorkPathArray(path)[3])
                        {
                            count++;
                        }
                        //check list for username
                        if (xmppManager.chats[count-1].chatWith.userID == getWorkPathArray(path)[2])
                        {
                            //found usrname
                            if (xmppManager.chats[count-1].chatWith.userID == getWorkPathArray(path)[2])
                            {
                                //Console.WriteLine("returning msg"+ getWorkPathArray(path)[3]);
                                chat currentChat = xmppManager.chats[count-1];

                                FileNode jidNode = new FileNode(getWorkPathArray(path)[3], fileTypes.Text);
                                //Console.WriteLine("looking for chat " + getWorkPathArray(path)[3]);
                                //Console.WriteLine("AKA: " + Convert.ToInt32(getWorkPathArray(path)[3]));
                                jidNode = new FileNode(getWorkPathArray(path)[3], fileTypes.Text);
                                jidNode.putData(currentChat.msgChain.ElementAt(Convert.ToInt32(getWorkPathArray(path)[3])).body);
                                return jidNode;
                            }
                            return null;
                        }
                    }
                    //file not found
                    return null;
                }
                else
                {
                    int count = 0;

                    while (count < xmppManager.chats.Count && xmppManager.chats[count].chatWith.userID != getWorkPathArray(path)[1])
                    {
                        count++;
                    }

                    if (xmppManager.chats.ElementAt(count-1).chatWith.userID == getWorkPathArray(path)[2])////
                    {
                        chat currentChat = xmppManager.chats.ElementAt(count - 1);

                        FileNode jidNode = new FileNode(getWorkPathArray(path)[2], fileTypes.Directory);
                        int msgcount = 0;

                        foreach (messages msg in currentChat.msgChain)
                        {
                            jidNode.addChild(new FileNode(msgcount.ToString(), fileTypes.Directory));
                            msgcount++;
                        }

                        return jidNode;
                    }
                    else
                        return new FileNode(getWorkPathArray(path)[1],fileTypes.Directory);
                }
            }
            else
            {
                FileNode contactListNode = new FileNode(path, fileTypes.Directory);

                foreach (chat chat in xmppManager.chats)
                {
                    contactListNode.addChild(new FileNode(chat.chatWith.userID, fileTypes.Directory));
                }

                return contactListNode;
            }
        }
        return null;
    }
开发者ID:Softsurve,项目名称:Silver-Iodide,代码行数:101,代码来源:XMPPFS.cs

示例4: write


//.........这里部分代码省略.........
            else if (aNode.getType() == fileTypes.Union)
            {
                loadPath = this.parsePath(aNode, path);
                int count = 0;
                while (count < aNode.getDirList().Count)
                {
                    this.touched(aNode);
                    this.write(aNode.getDirList()[count] + loadPath, flags, buffer, offset, length);
                    count++;
                }
                return (0);
            }
            else
                return -1;

        }
        else if (flags == writeFlags.CREATEDATAFILE)
        {
            aNode = this.walk(workPath);

            if (aNode.getType() == 1)
            {
                var count = 0;
                if (aNode.getDirList().Count > 0)
                {
                    while (count < aNode.getData().Length - 1 && aNode.getDirList()[count].getName() != pathArray[pathArray.Length - 1])
                    {
                        count++;
                    }
                    aNode.getDirList();
                    //Console.WriteLine("write file debug:\n count"+count+"\ndir list length"+aNode.getDirList().Count + "\npatharray" + pathArray[pathArray.Length - 1]);
                    if (aNode.getDirList()[count].getName() == pathArray[pathArray.Length - 1] && aNode.getDirList()[count].getName() != "")
                    {
                        aNode.getDirList()[count].putData(buffer);
                        this.touched(aNode);
                        return 0;
                    }
                }

                FileNode newFile = new FileNode(pathArray[pathArray.Length - 1], fileTypes.Text);

                newFile.addParent(aNode);
                aNode.addChild(newFile);

                if (aNode.countChildren() > 0)
                {
                    newFile.setPrev(aNode.getDirList().ElementAt(aNode.countChildren() - 1));
                }

                if (aNode.countChildren() >= 2)
                {
                    aNode.getDirList()[aNode.countChildren() - 2].setNext(newFile);
                }

                newFile.putData(buffer);
                this.touched(aNode);
                return 0;
            }

            else if (aNode.getType() == fileTypes.Mount)
            {
                loadPath = this.parsePath(aNode, path);
                return aNode.getMount().write(loadPath, flags, buffer, offset, length);
            }
            else if (aNode.getType() == fileTypes.Union)
            {
开发者ID:Softsurve,项目名称:Silver-Iodide,代码行数:67,代码来源:agi.cs


注:本文中的FileNode.putData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。