private void btnNewFolder_Click(object sender, EventArgs e) { try { if (nfsClient == null) { return; } NewFolder nf = new NewFolder(); if (nf.ShowDialog() == DialogResult.OK) { byte UserP, GroupP, OtherP; switch (nf.userPSelectedIndex) { case 0: UserP = 4; break; case 1: UserP = 6; break; case 2: UserP = 7; break; default: UserP = 7; break; } switch (nf.groupPSelectedIndex) { case 0: GroupP = 4; break; case 1: GroupP = 6; break; case 2: GroupP = 7; break; default: GroupP = 7; break; } switch (nf.otherPSelectedIndex) { case 0: OtherP = 4; break; case 1: OtherP = 6; break; case 2: OtherP = 7; break; default: OtherP = 7; break; } nfsClient.CreateDirectory( nfsClient.Combine(nf.NewFolderName, RemoteFolder), new NFSLibrary.Protocols.Commons.NFSPermission(UserP, GroupP, OtherP)); RefreshRemote(); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "NFS Client"); } }
public int CreateDirectory(string filename, DokanFileInfo info) { int ret = DokanNet.DOKAN_SUCCESS; filename = CleanFileName(filename); Debug("CreateDirectory {0}", filename); try { string Directory = nfsClient.GetDirectoryName(filename); string FileName = nfsClient.GetFileName(filename); string FullPath = nfsClient.Combine(FileName, Directory); if (nfsClient.FileExists(FullPath)) { return(DokanNet.ERROR_FILE_EXISTS); } byte UserP, GroupP, OtherP; UserP = 7; GroupP = 7; OtherP = 7; nfsClient.CreateDirectory(FullPath, new NFSLibrary.Protocols.Commons.NFSPermission(UserP, GroupP, OtherP)); } catch (Exception ex) { ret = DokanNet.DOKAN_ERROR; Debug("CreateFile file {0} exception {1}", filename, ex.Message); } return(ret); }