示例#1
0
文件: hellofs.cs 项目: jhult/pfmkit
    public void Access(Pfm.MarshallerAccessOp op)
    {
        long openId = op.OpenId();
        int  perr   = 0;

        Pfm.OpenAttribs openAttribs = new Pfm.OpenAttribs();

        if (openId == folderOpenId)
        {
            openAttribs.openId           = folderOpenId;
            openAttribs.openSequence     = 1;
            openAttribs.accessLevel      = Pfm.accessLevelReadData;
            openAttribs.attribs.fileType = Pfm.fileTypeFolder;
            openAttribs.attribs.fileId   = helloRootId;
        }
        else if (openId == fileOpenId)
        {
            openAttribs.openId           = fileOpenId;
            openAttribs.openSequence     = 1;
            openAttribs.accessLevel      = Pfm.accessLevelReadData;
            openAttribs.attribs.fileType = Pfm.fileTypeFile;
            openAttribs.attribs.fileId   = helloFileId;
            openAttribs.attribs.fileSize = helloFileData.Length;
        }
        else
        {
            perr = Pfm.errorNotFound;
        }

        op.Complete(perr, openAttribs, null);
    }
示例#2
0
文件: tempfs.cs 项目: jhult/pfmkit
    // Pfm.FormatterDispatch.Access
    // Read attributes for open file or folder.
    public void Access(Pfm.MarshallerAccessOp op)
    {
        long openId = op.OpenId();
        int  perr   = 0;

        Pfm.OpenAttribs openAttribs = new Pfm.OpenAttribs();
        File            file;

        perr = FileFindOpenId(openId, out file);
        if (perr == 0)
        {
            FileOpened(file, ref openAttribs);
        }

        op.Complete(perr, openAttribs, null);
    }
示例#3
0
        public void Access(Pfm.MarshallerAccessOp op)
        {
            long openId = op.OpenId();
            int  err    = 0;

            Pfm.OpenAttribs att = new Pfm.OpenAttribs();
            if (opens.ContainsKey(openId))
            {
                var entry = opens[openId];
                att.accessLevel = Pfm.accessLevelReadData;
                SetAttTime(ref att.attribs, entry);
                att.attribs.fileType = entry.isdir != 0 ? Pfm.fileTypeFolder : Pfm.fileTypeFile;
                att.attribs.fileId   = GetFileId(entry);
                att.attribs.fileSize = entry.size;
                att.openId           = openId;
                att.openSequence     = 1;
            }
            else
            {
                err = Pfm.errorNotFound;
            }
            op.Complete(err, att, null);
        }