Beispiel #1
0
        public void Move(string OldDirectoryFullName, string OldFileName, string NewDirectoryFullName, string NewFileName)
        {
            if (_ProtocolV2 == null)
            {
                throw new NFSConnectionException("NFS Client not connected!");
            }

            if (_MountProtocolV2 == null)
            {
                throw new NFSMountConnectionException("NFS Device not connected!");
            }

            NFSAttributes OldDirectory = GetItemAttributes(OldDirectoryFullName);
            NFSAttributes NewDirectory = GetItemAttributes(NewDirectoryFullName);

            RenameArguments dpArgRename = new RenameArguments();

            dpArgRename.From           = new ItemOperationArguments();
            dpArgRename.From.Directory = new NFSHandle(OldDirectory.Handle, V2.RPC.NFSv2Protocol.NFS_VERSION);
            dpArgRename.From.Name      = new Name(OldFileName);
            dpArgRename.To             = new ItemOperationArguments();
            dpArgRename.To.Directory   = new NFSHandle(NewDirectory.Handle, V2.RPC.NFSv2Protocol.NFS_VERSION);
            dpArgRename.To.Name        = new Name(NewFileName);

            NFSStats Status =
                (NFSStats)_ProtocolV2.NFSPROC_RENAME(dpArgRename);

            if (Status != NFSStats.NFS_OK)
            {
                ExceptionHelpers.ThrowException(Status);
            }
        }
Beispiel #2
0
        public void Move(string OldDirectoryFullName, string OldFileName, string NewDirectoryFullName, string NewFileName)
        {
            if (_ProtocolV3 == null)
            {
                throw new NFSConnectionException("NFS Client not connected!");
            }

            if (_MountProtocolV3 == null)
            {
                throw new NFSMountConnectionException("NFS Device not connected!");
            }

            NFSAttributes OldDirectory = GetItemAttributes(OldDirectoryFullName);
            NFSAttributes NewDirectory = GetItemAttributes(NewDirectoryFullName);

            RenameArguments dpArgRename = new RenameArguments();

            dpArgRename.From           = new ItemOperationArguments();
            dpArgRename.From.Directory = new NFSHandle(OldDirectory.Handle, V3.RPC.NFSv3Protocol.NFS_V3);
            dpArgRename.From.Name      = new Name(OldFileName);
            dpArgRename.To             = new ItemOperationArguments();
            dpArgRename.To.Directory   = new NFSHandle(NewDirectory.Handle, V3.RPC.NFSv3Protocol.NFS_V3);
            dpArgRename.To.Name        = new Name(NewFileName);

            ResultObject <RenameAccessOK, RenameAccessFAIL> pRenameRes =
                _ProtocolV3.NFSPROC3_RENAME(dpArgRename);

            if (pRenameRes == null || pRenameRes.Status != NFSStats.NFS_OK)
            {
                if (pRenameRes == null)
                {
                    throw new NFSGeneralException("NFSPROC3_WRITE: failure");
                }

                ExceptionHelpers.ThrowException(pRenameRes.Status);
            }
        }