C#.NET
using TKFP.IO;
private void ChangePermission(FileInfo file)
{
Permission per;
per = new Permission(
PermissionFlag.Readable | PermissionFlag.Writable | PermissionFlag.Executable ,
PermissionFlag.Readable ,
PermissionFlag.Readable );
file.Permission = per;
per = new Permission(
PermissionFlag.Readable | PermissionFlag.Writable ,
PermissionFlag.none ,
PermissionFlag.none);
file.Permission = per;
per = new Permission(
file.Permission.User | PermissionFlag.Executable,
file.Permission.Group | PermissionFlag.Executable,
file.Permission.Other | PermissionFlag.Executable);
file.Permission = per;
}
VB.NET
Imports TKFP.IO
Sub ChangePermission(ByVal file As FileInfo)
Dim per As Permission
per = New Permission( _
PermissionFlag.Readable Or PermissionFlag.Writable Or PermissionFlag.Executable, _
PermissionFlag.Readable, _
PermissionFlag.Readable)
file.Permission = per
per = New Permission( _
PermissionFlag.Readable Or PermissionFlag.Writable, _
PermissionFlag.none, _
PermissionFlag.none)
file.Permission = per
per = New Permission( _
file.Permission.User Or PermissionFlag.Executable, _
file.Permission.Group Or PermissionFlag.Executable, _
file.Permission.Other Or PermissionFlag.Executable)
file.Permission = per
End Sub
VB.NETのコードはC#.NETを元に「
C#.NET to VB.NET Translator」によって作成したものです
実際にFTPサーバーへの書き込みが行われるのは、Permissionプロパティへの書き込みが行われるときです。 このため、この動作を行うときはサーバーでの接続が維持されている必要があります。