source: Include/Classes/System/IO/DriveInfo.ab@ 272

Last change on this file since 272 was 271, checked in by dai, 17 years ago

SHFILEOPSTRUCT.hWnd → SHFILEOPSTRUCT.hwnd
System.IOに属するクラスに名前空間を適用した。

File size: 2.1 KB
Line 
1Namespace System
2Namespace IO
3
4
5Enum DriveType
6 Unknown = 0
7 NoRootDirectory
8 Removable
9 Fixed
10 CDRom
11 Network
12 Ram
13End Enum
14
15Class DriveInfo
16 m_DriveName As String
17Public
18 Sub DriveInfo(driveName As String)
19 If driveName.Length <> 1 Then
20 'ArgumentException
21 debug
22 End If
23 driveName.ToUpper()
24 m_DriveName = driveName + ":\"
25 End Sub
26
27 Sub ~DriveInfo()
28 End Sub
29
30 'property
31 Function AvailableFreeSpace() As QWord
32 Dim availableFreeSpace As ULARGE_INTEGER
33 If GetDiskFreeSpaceEx(m_DriveName, availableFreeSpace, ByVal 0, ByVal 0) Then
34 Return (availableFreeSpace.HighPart << 32) Or availableFreeSpace.LowPart
35 Else
36 'IOException
37 End If
38 End Function
39
40 Function DriveFormat() As String
41 Dim systemName[15] As TCHAR
42 If GetVolumeInformation(m_DriveName, NULL, NULL, NULL, NULL, NULL, systemName, Len (systemName)) Then
43 Return systemName
44 Else
45 'IOException
46 End If
47 End Function
48
49 Function DriveType() As Long
50 Return GetDriveType(m_DriveName)
51 End Function
52
53 Function IsReady() As Boolean
54 If GetVolumeInformation(m_DriveName, NULL, NULL, NULL, NULL, NULL, NULL, NULL) Then
55 Return True
56 Else
57 Return False
58 End If
59 End Function
60
61 Function Name() As String
62 Return m_DriveName
63 End Function
64
65/* Function RootDirectory() As DirectoryInfo
66 End Function*/
67
68 Function TotalFreeSpace() As QWord
69 Dim totalFreeSpace As ULARGE_INTEGER
70 If GetDiskFreeSpaceEx(m_DriveName, ByVal 0, ByVal 0, totalFreeSpace) Then
71 Return (totalFreeSpace.HighPart << 32) Or totalFreeSpace.LowPart
72 Else
73 'IOException
74 End If
75 End Function
76
77 Function TotalSize() As QWord
78 Dim totalSize As ULARGE_INTEGER
79 If GetDiskFreeSpaceEx(m_DriveName, ByVal 0, totalSize, ByVal 0) Then
80 Return (totalSize.HighPart << 32) Or totalSize.LowPart
81 Else
82 'IOException
83 End If
84 End Function
85
86 Function VolumeLabel() As String
87 Dim volumeName[63] As TCAHR
88 If GetVolumeInformation(m_DriveName, volumeName, 64, NULL, NULL, NULL, NULL, NULL) Then
89 Return volumeName
90 Else
91 'IOException
92 End If
93 End Function
94End Class
95
96
97End Namespace
98End Namespace
Note: See TracBrowser for help on using the repository browser.