Namespace System Namespace IO Class DirectoryInfo Inherits FileSystemInfo Public Sub DirectoryInfo(path As String) OriginalPath = path FullPath = Path.GetFullPath(path) Refresh() End Sub Sub ~DirectoryInfo() End Sub 'Public Property Function Parent() As DirectoryInfo Dim dirInfo As DirectoryInfo(Path.GetDirectoryName(FullPath)) Return dirInfo End Function Function Root() As DirectoryInfo Dim dirInfo As DirectoryInfo(Path.GetPathRoot(FullPath)) Return dirInfo End Function 'Public Method Sub Create() CreateDirectory(ToTCStr(FullPath), NULL) End Sub /* Sub Create(directorySecurity As DirectorySecurity) End Sub*/ Override Sub Delete() RemoveDirectory(ToTCStr(FullPath)) End Sub Sub Delete(recursive As Boolean) If recursive Then ' ディレクトリ内のすべての情報を削除する Dim dirPath = FullPath As String ' 終端の '\' を除去 If dirPath[dirPath.Length-1] = Asc("\") Then dirPath = dirPath.Substring(0, dirPath.Length-1) End If ' double null-terminated にする dirPath = dirPath + Chr$(0) Dim op As SHFILEOPSTRUCT op.hwnd = NULL op.wFunc = FO_DELETE op.pFrom = ToTCStr(dirPath) op.pTo = NULL op.fFlags = FOF_NOCONFIRMATION or FOF_NOERRORUI or FOF_SILENT If SHFileOperation(op) <> 0 Then ' TODO: エラー処理 debug End If Else ' ディレクトリが空の場合は削除する This.Delete() End If End Sub /* Function GetAccessControl() As DirectorySecurity End Function*/ /* Function GetAccessControl(includeSections As AccessControlSections) As DirectorySecurity End Function*/ /* Function GetDirectories() As Array End Function*/ /* Function GetDirectories(searchPattern As String) As Array End Function*/ /* Function GetDirectories(searchPattern As String, searchOption As SearchOption) As Array End Function*/ /* Function GetFiles() As Array End Function*/ /* Function GetFiles(searchPattern As String) As Array End Function*/ /* Function GetFiles(searchPattern As String, searchOption As SearchOption) As Array End Function*/ /* Function GetFileSystemInfos() As Array End Function*/ /* Function GetFileSystemInfos(searchPattern As String) As Array End Function*/ Sub MoveTo(destDirName As String) If MoveFile(ToTCStr(FullPath), ToTCStr(destDirName)) = FALSE Then 'Exception End If End Sub /* Sub SetAccessControl(directorySecurity As DirectorySecurity) End Sub*/ End Class Enum SearchOption AllDirectories TopDirectoryOnly End Enum End Namespace End Namespace