Пример #1
0
    // Pfm.FormatterDispatch.List
    public void List(Pfm.MarshallerListOp op)
    {
        long       openId = op.OpenId();
        long       listId = op.ListId();
        int        perr   = 0;
        bool       noMore = true;
        SortedList children;

        Pfm.Attribs attribs = new Pfm.Attribs();
        OpenRef     openRef;
        ListRef     listRef;
        NameLink    nameLink;
        File        file;

        openRef = (OpenRef)(openRefs.Get(openId));
        if (openRef == null)
        {
            perr = Pfm.errorInvalid;
        }
        else
        {
            listRef = (ListRef)(openRef.listRefs.Get(listId));
            if (listRef == null)
            {
                listRef = new ListRef();
                openRef.listRefs.Set(listId, listRef);
            }
            children = openRef.file.children;
            while (true)
            {
                if (listRef.position >= children.Count)
                {
                    noMore = true;
                }
                else
                {
                    nameLink           = (NameLink)(children.GetByIndex(listRef.position));
                    file               = nameLink.file;
                    attribs.fileId     = file.fileId;
                    attribs.fileType   = file.fileType;
                    attribs.createTime = file.createTime;
                    attribs.accessTime = file.accessTime;
                    attribs.writeTime  = file.writeTime;
                    attribs.changeTime = file.changeTime;
                    attribs.fileSize   = file.fileSize;
                    if (op.Add(attribs, nameLink.endName))
                    {
                        listRef.position++;
                        continue;
                    }
                }
                break;
            }
        }

        op.Complete(perr, noMore);
    }