Ejemplo n.º 1
0
    int /*perr*/ FileNameRemove(File parent, long writeTime, string endName, File file)
    {
        int      perr = Pfm.errorNotFound;
        NameLink nameLink;
        string   foldedName = endName.ToLower();

        nameLink = (NameLink)(parent.children[foldedName]);
        if (nameLink != null && nameLink.file == file)
        {
            perr = 0;
            parent.children.Remove(foldedName);
            parent.writeTime  = writeTime;
            parent.changeTime = writeTime;
            file.nameCount--;
            if (file.nameCount == 0)
            {
                fileIds.Remove(file.fileId);
                if (openRefs.Get(file.openId) == null)
                {
                    FileWrite(file, 0, null, 0);
                }
            }
        }
        return(perr);
    }
Ejemplo n.º 2
0
    // Pfm.FormatterDispatch.Close
    public void Close(Pfm.MarshallerCloseOp op)
    {
        long    openId       = op.OpenId();
        long    openSequence = op.OpenSequence();
        int     perr         = 0;
        OpenRef openRef;

        openRef = (OpenRef)(openRefs.Get(openId));
        if (openRef == null)
        {
            perr = Pfm.errorInvalid;
        }
        else
        {
            if (openRef.openSequence <= openSequence)
            {
                openRefs.Remove(openId);
                if (openRef.file.nameCount == 0)
                {
                    FileWrite(openRef.file, 0, null, 0);
                }
            }
        }

        op.Complete(perr);
    }