「VBScript_Class」の編集履歴(バックアップ)一覧はこちら
「VBScript_Class」(2009/01/13 (火) 16:12:06) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
-ファイルアクセスクラス
Option Explicit
Class CFileAcs
Private m_strPath
Private m_strUpdateDate
Private m_nLastLine
Private m_nReadPointer
Private m_astrData
'ファイルパス
Public Property Let FilePath(ByVal value)
m_strPath = value
End Property
Public Property Get FilePath()
FilePath = m_strPath
End Property
'ファイル更新日付
Public Property Let FileUpdateDate(ByVal value)
m_strUpdateDate = value
End Property
Public Property Get FileUpdateDate()
FileUpdateDate = m_strUpdateDate
End Property
'読込最終行数
Public Property Let LastLine(ByVal value)
m_nLastLine = value
End Property
Public Property Get LastLine()
LastLine = m_nLastLine
End Property
'読込データ
Public Property Get ReadData()
Set ReadData = m_astrData
End Property
Public Property Get ReadLineData(Byval vIndex)
ReadLineData = vbNullString
If vIndex <= UBound(m_astrData) Then
ReadLineData = m_astrData(vIndex)
End If
End Property
Public Sub init(ByVal strFilePath)
m_strPath = strFilePath
m_strUpdateDate = vbNullString
m_nLastLine = 0
m_nReadPointer = 1
End Sub
Public Sub FileRandomRead()
Dim objFSO ' FileSystemObject
Dim objFile ' ファイル読み込み用
Dim strData ' ファイル読み込み用
Set objFSO = CreateObject( "Scripting.FileSystemObject")
If Err.Number = 0 Then
Set objFile = objFSO.OpenTextFile( m_strPath)
If Err.Number = 0 Then
strData = objFile.ReadAll
objFile.Close
Else
MsgBox "ファイルオープンエラー: " & Err.Description
End If
Else
MsgBox "エラー: " & Err.Description
End If
m_astrData = split( strData,vbCrLf)
m_nLastLine = UBound( m_astrData)
Set objFile = Nothing
Set objFSO = Nothing
End Sub
Public Function ChkFileChange()
If g_strFileUpdate = FileDateTime( g_strFilePath) Then
ChkFileChange = False
Else
ChkFileChange = True
End If
End Function
End Class
-ファイルアクセスクラス
Option Explicit
Class CFileAcs
Private m_strPath
Private m_strUpdateDate
Private m_nLastLine
Private m_nReadPointer
Private m_astrData
'ファイルパス
Public Property Let FilePath(ByVal value)
m_strPath = value
End Property
Public Property Get FilePath()
FilePath = m_strPath
End Property
'ファイル更新日付
Public Property Let FileUpdateDate(ByVal value)
m_strUpdateDate = value
End Property
Public Property Get FileUpdateDate()
FileUpdateDate = m_strUpdateDate
End Property
'読込最終行数
Public Property Let LastLine(ByVal value)
m_nLastLine = value
End Property
Public Property Get LastLine()
LastLine = m_nLastLine
End Property
'読込データ
Public Property Get ReadData()
Set ReadData = m_astrData
End Property
Public Property Get ReadLineData(Byval vIndex)
ReadLineData = vbNullString
If vIndex <= UBound(m_astrData) Then
ReadLineData = m_astrData(vIndex)
End If
End Property
Public Sub init(ByVal strFilePath)
m_strPath = strFilePath
m_strUpdateDate = vbNullString
m_nLastLine = 0
m_nReadPointer = 1
End Sub
Public Sub FileRandomRead()
Dim objFSO ' FileSystemObject
Dim objFile ' ファイル読み込み用
Dim strData ' ファイル読み込み用
Set objFSO = CreateObject( "Scripting.FileSystemObject")
If Err.Number = 0 Then
Set objFile = objFSO.OpenTextFile( m_strPath)
If Err.Number = 0 Then
strData = objFile.ReadAll
objFile.Close
Else
MsgBox "ファイルオープンエラー: " & Err.Description
End If
Else
MsgBox "エラー: " & Err.Description
End If
m_astrData = split( strData,vbCrLf)
m_nLastLine = UBound( m_astrData)
Set objFile = Nothing
Set objFSO = Nothing
End Sub
Public Function ChkFileChange()
If g_strFileUpdate = FileDateTime( g_strFilePath) Then
ChkFileChange = False
Else
ChkFileChange = True
End If
End Function
End Class
表示オプション
横に並べて表示:
変化行の前後のみ表示: