Ignore:
Timestamp:
Jan 22, 2008, 9:19:59 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

_System_CThreadCollectionでのクラスインスタンスへのポインタの使用を除去、参照変数構文へ。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/IO/DriveInfo.ab

    r288 r400  
    2121            debug
    2222        End If
    23         driveName.ToUpper()
    24         m_DriveName = driveName + ":\"
     23        m_DriveName = driveName.ToUpper() + ":\"
    2524    End Sub
    2625
     
    3029    'property
    3130    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
     31        If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal VarPtr(AvailableFreeSpace) As *ULARGE_INTEGER, ByVal 0, ByVal 0) = FALSE Then
     32            Throw New IOException("DriveInfo.AvailableFreeSpace: Failed to GetDiskFreeSpaceEx.")
    3733        End If
    3834    End Function
     
    4036    Function DriveFormat() As String
    4137        Dim systemName[15] As TCHAR
    42         If GetVolumeInformation(m_DriveName, NULL, 0, NULL, NULL, NULL, systemName, Len (systemName)) Then
    43             Dim resultStr = New String( systemName )
    44             Return resultStr
     38        If GetVolumeInformation(ToTCStr(m_DriveName), NULL, 0, NULL, NULL, NULL, systemName, Len (systemName) \ SizeOf (TCHAR)) Then
     39            DriveFormat = New String( systemName )
    4540        Else
    46             'IOException
     41            Throw New IOException("DriveInfo.DriveFormat: Failed to GetVolumeInformation.")
    4742        End If
    4843    End Function
    4944
    5045    Function DriveType() As Long
    51         Return GetDriveType(m_DriveName)
     46        Return GetDriveType(ToTCStr(m_DriveName))
    5247    End Function
    5348
    5449    Function IsReady() As Boolean
    55         If GetVolumeInformation(m_DriveName, NULL, 0, NULL, NULL, NULL, NULL, 0) Then
     50        If GetVolumeInformation(ToTCStr(m_DriveName), NULL, 0, NULL, NULL, NULL, NULL, 0) Then
    5651            Return True
    5752        Else
     
    6863
    6964    Function TotalFreeSpace() As QWord
    70         Dim totalFreeSpace As ULARGE_INTEGER
    71         If GetDiskFreeSpaceEx(m_DriveName, ByVal 0, ByVal 0, totalFreeSpace) Then
    72             Return (totalFreeSpace.HighPart << 32) Or totalFreeSpace.LowPart
    73         Else
    74             'IOException
     65        If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal 0, ByVal 0, ByVal VarPtr(TotalFreeSpace) As *ULARGE_INTEGER) = FALSE Then
     66            Throw New IOException("DriveInfo.TotalFreeSpace: Failed to GetDiskFreeSpaceEx.")
    7567        End If
    7668    End Function
    7769
    7870    Function TotalSize() As QWord
    79         Dim totalSize As ULARGE_INTEGER
    80         If GetDiskFreeSpaceEx(m_DriveName, ByVal 0, totalSize, ByVal 0) Then
    81             Return (totalSize.HighPart << 32) Or totalSize.LowPart
    82         Else
    83             'IOException
     71        If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal 0, ByVal VarPtr(TotalSize) As *ULARGE_INTEGER, ByVal 0) = FALSE Then
     72            Throw New IOException("DriveInfo.TotalSize: Failed to GetDiskFreeSpaceEx.")
    8473        End If
    8574    End Function
     
    8776    Function VolumeLabel() As String
    8877        Dim volumeName[63] As TCHAR
    89         If GetVolumeInformation(m_DriveName, volumeName, 64, NULL, NULL, NULL, NULL, 0) Then
    90             Dim resultStr = New String( volumeName )
    91             Return resultStr
     78        If GetVolumeInformation(ToTCStr(m_DriveName), volumeName, Len (volumeName) \ SizeOf (TCHAR), NULL, NULL, NULL, NULL, 0) Then
     79            VolumeLabel = New String( volumeName )
    9280        Else
    93             'IOException
     81            Throw New IOException("DriveInfo.VolumeLabel: Failed to GetVolumeInformation.")
    9482        End If
    9583    End Function
Note: See TracChangeset for help on using the changeset viewer.