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

FileSystemInfo.FileAttributesを修整

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.