// Pfm.FormatterDispatch.Move // Open an existing target file, or move a previously opened // file to a _new target name if the target does not exist. public void Move(Pfm.MarshallerMoveOp op) { long sourceOpenId = op.SourceOpenId(); long sourceParentFileId = op.SourceParentFileId(); string sourceEndName = op.SourceEndName(); string[] targetNameParts = op.TargetNameParts(); bool deleteSource = op.DeleteSource(); long writeTime = op.WriteTime(); long newExistingOpenId = op.NewExistingOpenId(); int perr; bool existed = false; Pfm.OpenAttribs openAttribs = new Pfm.OpenAttribs(); long parentFileId = 0; string endName = null; File sourceFile; File targetParent; File targetFile; File sourceParent; perr = FileFindOpenId(sourceOpenId, out sourceFile); if (perr == 0) { perr = FileFindName(targetNameParts, out targetParent, out targetFile, out endName); if (perr == 0) { existed = true; if (targetParent != null) { parentFileId = targetParent.fileId; } if (targetFile.openId == 0) { targetFile.openId = newExistingOpenId; } FileOpened(targetFile, ref openAttribs); } else if (perr == Pfm.errorNotFound) { FileNameAdd(targetParent, writeTime, endName, sourceFile); perr = 0; parentFileId = targetParent.fileId; FileOpened(sourceFile, ref openAttribs); if (deleteSource && FileFindFileId(sourceParentFileId, out sourceParent) == 0) { FileNameRemove(sourceParent, writeTime, sourceEndName, sourceFile); } } } op.Complete(perr, existed, openAttribs, parentFileId, endName, 0, null, 0, null); }
public void Move(Pfm.MarshallerMoveOp op) { op.Complete(Pfm.errorAccessDenied, false /*existed*/, null /*openAttribs*/, 0 /*parentFileId*/, null /*endName*/, 0, null, 0, null); }