Changeset 406 for trunk/Include/Classes


Ignore:
Timestamp:
Feb 15, 2008, 7:48:54 PM (16 years ago)
Author:
OverTaker
Message:

FileSystemInfo.FileAttributesを修整

Location:
trunk/Include/Classes/System/IO
Files:
4 edited

Legend:

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

    r404 r406  
    137137        Dim i As Long
    138138        For i = 0 To ELM(infos.Count)
    139             If infos[i].Attributes = FILE_ATTRIBUTE_DIRECTORY Then
     139            If (infos[i].Attributes and FileAttributes.Directory) = FileAttributes.Directory Then
    140140                dirs.Add(infos[i] As DirectoryInfo)
    141141            End If
     
    196196        Dim i As Long
    197197        For i = 0 To ELM(infos.Count)
    198             If infos[i].Attributes <> FILE_ATTRIBUTE_DIRECTORY Then
     198            If (infos[i].Attributes and FileAttributes.Directory) <> FileAttributes.Directory Then
    199199                files.Add(infos[i] As FileInfo)
    200200            End If
  • trunk/Include/Classes/System/IO/File.ab

    r271 r406  
    1010
    1111Enum FileAttributes
    12     Archive
    13     Compressed
    14     Device
    15     Directory
    16     Encrypted
    17     Hidden
    18     Normal
    19     NotContentIndexed
    20     Offline
    21     ReadOnly
    22     ReparsePoint
    23     SparseFile
    24     System
    25     Temporary
     12    Archive           = 32 'FILE_ATTRIBUTE_ARCHIVE
     13    Compressed        = 2048 'FILE_ATTRIBUTE_COMPRESSED
     14    Device            = 64 'FILE_ATTRIBUTE_DEVICE
     15    Directory         = 16 'FILE_ATTRIBUTE_DIRECTORY
     16    Encrypted         = 16384 'FILE_ATTRIBUTE_ENCRYPTED
     17    Hidden            = 2 'FILE_ATTRIBUTE_HIDDEN
     18    Normal            = 128 'FILE_ATTRIBUTE_NORMAL
     19    NotContentIndexed = 8192 'FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
     20    Offline           = 4096 'FILE_ATTRIBUTE_OFFLINE
     21    ReadOnly          = 1 'FILE_ATTRIBUTE_READONLY
     22    ReparsePoint      = 1024 'FILE_ATTRIBUTE_REPARSE_POINT
     23    SparseFile        = 512 'FILE_ATTRIBUTE_SPARSE_FILE
     24    System            = 4 'FILE_ATTRIBUTE_SYSTEM
     25    Temporary         = 256 'FILE_ATTRIBUTE_TEMPORARY
    2626End Enum
    2727
  • trunk/Include/Classes/System/IO/FileInfo.ab

    r345 r406  
    2727
    2828    Function IsReadOnly() As Boolean
    29         If (Attributes And FILE_ATTRIBUTE_READONLY) = FILE_ATTRIBUTE_READONLY Then
     29        If (Attributes and FileAttributes.ReadOnly) = FileAttributes.ReadOnly Then
    3030            Return True
    3131        Else
  • trunk/Include/Classes/System/IO/FileSystemInfo.ab

    r400 r406  
    77    m_LastAccessTime As FILETIME
    88    m_LastWriteTime As FILETIME
    9     m_FileAttributes As DWord
     9    m_FileAttributes As FileAttributes
    1010
    1111    m_IsFreshed As Boolean
     
    1414    OriginalPath As String
    1515Public
     16
     17    /*!
     18    @brief  コンストラクタ
     19    @author OverTaker
     20    */
    1621    Sub FileSystemInfo()
    1722        m_IsFreshed = False
    1823    End Sub
    1924
     25    /*!
     26    @brief  デストラクタ
     27    @author OverTaker
     28    */
    2029    Sub ~FileSystemInfo()
    2130    End Sub
    2231
     32    /*!
     33    @brief  値が等しいか比較する
     34    @author OverTaker
     35    @param  比較するオブジェクト
     36    @return 等しい場合True,そうでない場合False
     37    */
    2338    Override Function Equals( object As Object ) As Boolean
    2439        If This.ToString = object.ToString Then
     
    2944    End Function
    3045
     46    /*!
     47    @brief  文字列で表したオブジェクトを取得する
     48    @author OverTaker
     49    @return オブジェクトの文字列(ファイルパス)
     50    */
    3151    Override Function ToString() As String
    3252        Return FullPath
    3353    End Function
    3454
    35     'Public Properties
    36     Function Attributes() As DWord'FileAttributes
     55    '----------------------------------------------------------------
     56    ' パブリック プロパティ
     57    '----------------------------------------------------------------
     58
     59    /*!
     60    @brief  ファイルの属性を取得する
     61    @author OverTaker
     62    @return ファイル属性
     63    */
     64    Function Attributes() As FileAttributes
    3765        If Not m_IsFreshed Then Refresh()
    3866        Return m_FileAttributes
    3967    End Function
    4068
    41     Sub Attributes(value As DWord)
     69    /*!
     70    @brief  ファイル属性を設定する
     71    @author OverTaker
     72    @param  ファイル属性
     73    */
     74    Sub Attributes(value As FileAttributes)
    4275        If SetFileAttributes(ToTCStr(FullPath), value) = FALSE Then
    4376            'Exception
     
    4679    End Sub
    4780
     81    /*!
     82    @brief  ファイル作成日を取得する
     83    @author OverTaker
     84    @return ファイルの作成日
     85    */
    4886    Function CreationTime() As DateTime
    4987        If Not m_IsFreshed Then Refresh()
     
    5189    End Function
    5290
     91    /*!
     92    @brief  ファイル作成日を設定する
     93    @author OverTaker
     94    @param  ファイルの作成日
     95    */
    5396    Sub CreationTime(ByRef value As DateTime)
    5497        m_CreationTime = value.ToFileTimeUtc()
     
    5699    End Sub
    57100
     101    /*!
     102    @brief  ファイル作成日をUTC時刻で取得する
     103    @author OverTaker
     104    @return ファイルの作成日(UTC)
     105    */
    58106    Function CreationTimeUtc() As DateTime
    59107        Return CreationTime.ToUniversalTime()
    60108    End Function
    61109
     110    /*!
     111    @brief  ファイル作成日をUTC時刻で設定する
     112    @author OverTaker
     113    @param  ファイルの作成日(UTC)
     114    */
    62115    Sub CreationTimeUtc(ByRef value As DateTime)
    63116        CreationTime = value
    64117    End Sub
    65118
     119    /*!
     120    @brief  ファイル最終アクセス日を取得する
     121    @author OverTaker
     122    @return ファイルの最終アクセス日
     123    */
    66124    Function LastAccessTime() As DateTime
    67125        If Not m_IsFreshed Then Refresh()
     
    69127    End Function
    70128
     129    /*!
     130    @brief  ファイル最終アクセス日を設定する
     131    @author OverTaker
     132    @param  ファイルの最終アクセス日
     133    */
    71134    Sub LastAccessTime(ByRef value As DateTime)
    72135        m_LastAccessTime = value.ToFileTimeUtc()
     
    74137    End Sub
    75138
     139    /*!
     140    @brief  ファイル最終アクセス日をUTC時刻で取得する
     141    @author OverTaker
     142    @return ファイルの最終アクセス日(UTC)
     143    */
    76144    Function LastAccessTimeUtc() As DateTime
    77145        Return LastAccessTime.ToUniversalTime()
    78146    End Function
    79147
     148    /*!
     149    @brief  ファイル最終アクセス日をUTC時刻で設定する
     150    @author OverTaker
     151    @param  ファイルの最終アクセス日(UTC)
     152    */
    80153    Sub LastAccessTimeUtc(ByRef value As DateTime)
    81154        LastAccessTime = value
    82155    End Sub
    83156
     157    /*!
     158    @brief  ファイルの最終書き込み日を取得する
     159    @author OverTaker
     160    @return ファイルの最終書き込み日
     161    */
    84162    Function LastWriteTime() As DateTime
    85163        If Not m_IsFreshed Then Refresh()
     
    87165    End Function
    88166
     167    /*!
     168    @brief  ファイルの最終書き込み日を設定する
     169    @author OverTaker
     170    @param  ファイルの最終書き込み日
     171    */
    89172    Sub LastWriteTime(ByRef value As DateTime)
    90173        m_LastWriteTime = value.ToFileTimeUtc()
     
    92175    End Sub
    93176
     177    /*!
     178    @brief  ファイルの最終書き込み日をUTC時刻で取得する
     179    @author OverTaker
     180    @return ファイルの最終書き込み日(UTC)
     181    */
    94182    Function LastWriteTimeUtc() As DateTime
    95183        Return LastWriteTime.ToUniversalTime()
    96184    End Function
    97185
     186    /*!
     187    @brief  ファイルの最終書き込み日をUTC時刻で設定する
     188    @author OverTaker
     189    @param  ファイルの最終書き込み日(UTC)
     190    */
    98191    Sub LastWriteTimeUtc(ByRef value As DateTime)
    99192        LastWriteTime = value
    100193    End Sub
    101194
     195    /*!
     196    @brief  ファイルが存在するかどうかを取得する
     197    @author OverTaker
     198    @return ファイルが存在する場合True,そうでない場合False
     199    */
    102200    Function Exists() As Boolean
    103201        If Not m_IsFreshed Then Refresh()
     
    109207    End Function
    110208
     209    /*!
     210    @brief  ファイル拡張子を取得する
     211    @author OverTaker
     212    @return ファイル拡張子
     213    */
    111214    Function Extension() As String
    112215        Return Path.GetExtension(FullPath)
    113216    End Function
    114217
     218    /*!
     219    @brief  ファイルパスを取得する
     220    @author OverTaker
     221    @return ファイルパス
     222    */
    115223    Function FullName() As String
    116224        Return FullPath
    117225    End Function
    118226
     227    /*!
     228    @brief  ファイル名を取得する
     229    @author OverTaker
     230    @return ファイル名
     231    */
    119232    Function Name() As String
    120233        Return Path.GetFileName(FullPath)
    121234    End Function
    122235
    123     'Public Methods
     236
     237    '----------------------------------------------------------------
     238    ' パブリック メソッド
     239    '----------------------------------------------------------------
     240
     241    /*!
     242    @brief  ファイルを削除する
     243    @author OverTaker
     244    */
    124245    Virtual Sub Delete()
    125246        If DeleteFile(ToTCStr(FullPath)) = FALSE Then
    126             'Exception
    127             debug
    128         End If
    129     End Sub
    130 
     247            Throw 'Exception
     248        End If
     249    End Sub
     250
     251    /*!
     252    @brief  ファイルを最新の情報に更新する
     253    @author OverTaker
     254    */
    131255    Virtual Sub Refresh()
    132256        Dim data As WIN32_FIND_DATA
     
    134258        FindClose(hFind)
    135259
    136         m_FileAttributes = data.dwFileAttributes
     260        m_FileAttributes = New FileAttributes(data.dwFileAttributes As Long, "FileAttributes")
    137261        m_CreationTime = data.ftCreationTime
    138262        m_LastAccessTime = data.ftLastAccessTime
     
    141265        m_IsFreshed = True
    142266    End Sub
     267
     268   
     269    '----------------------------------------------------------------
     270    ' パブリック プライベート
     271    '----------------------------------------------------------------
    143272Private
     273
     274    /*!
     275    @brief  ファイルの時間を更新する
     276    @author OverTaker
     277    */
    144278    Sub setFileTime()
    145279        If Not m_IsFreshed Then Refresh()
Note: See TracChangeset for help on using the changeset viewer.