Exemplo n.º 1
0
    // Pfm.FormatterDispatch.Replace
    // Replace an existing file with a newly created file.
    public void Replace(Pfm.MarshallerReplaceOp op)
    {
        long   targetOpenId       = op.TargetOpenId();
        long   targetParentFileId = op.TargetParentFileId();
        string targetEndName      = op.TargetEndName();
        int    createFileFlags    = op.CreateFileFlags();
        long   writeTime          = op.WriteTime();
        long   newCreateOpenId    = op.NewCreateOpenId();
        int    perr;

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

        perr = FileFindOpenId(targetOpenId, out targetFile);
        if (perr == 0)
        {
            perr = FileFindFileId(targetParentFileId, out parent);
            if (perr == 0)
            {
                file = new File(targetFile.fileType, createFileFlags, writeTime);
                perr = FileNameRemove(parent, writeTime, targetEndName, targetFile);
                if (perr == 0)
                {
                    FileNameAdd(parent, writeTime, targetEndName, file);
                    file.openId = newCreateOpenId;
                    FileOpened(file, ref openAttribs);
                }
            }
        }

        op.Complete(perr, openAttribs, null);
    }
Exemplo n.º 2
0
 public void Replace(Pfm.MarshallerReplaceOp op)
 {
     op.Complete(Pfm.errorAccessDenied, null /*openAttribs*/, null);
 }