16,554
社区成员
发帖
与我相关
我的任务
分享
Module Type
Structure TaskInfo
<VBFixedString(17)> Public Title As String
Public int1 As Integer
Public int2 As Integer
<VBFixedArray(3)> Public ID() As Byte
Public int3 As Integer
Public int4 As Integer
<VBFixedArray(4)> Public b1() As Byte
<VBFixedArray(4)> Public b2() As Byte
<VBFixedArray(4)> Public b3() As Byte
<VBFixedArray(4)> Public b4() As Byte
<VBFixedArray(4)> Public b5() As Byte
<VBFixedArray(4)> Public b6() As Byte
<VBFixedArray(4)> Public b7() As Byte
<VBFixedArray(4)> Public b8() As Byte
<VBFixedArray(4)> Public b9() As Byte
<VBFixedArray(4)> Public b10() As Byte
End Structure
End Module
Module FuncTask
Function GetTaskList() As TaskInfo()
Dim TempList() As TaskInfo
Dim i As Long
Dim Size As Long
Dim FileList() As String
ReDim TempList(0 To CLng("&HFFFFFF"))
FileList = System.IO.Directory.GetFiles(Application.StartupPath & "\task\")
For i = 0 To UBound(FileList) - 1
If System.IO.Path.GetExtension(FileList(i)) = ".qed" Then
TempList(Size) = GetInfo(FileList(i))
Size = Size + 1
End If
Next
ReDim Preserve TempList(0 To Size)
Return TempList
End Function
Function GetInfo(ByVal FilePath As String) As TaskInfo
Dim TempTask As TaskInfo
Try
FileOpen(1, FilePath, OpenMode.Binary, OpenAccess.Default)
FileGet(1, TempTask, 1)
Catch ex As Exception
MsgBox("Error:0x00000001" & Chr(9) & Chr(13) & "Open files error" & Chr(13) & "Log:" & Chr(13) & "-------------------------------" & Chr(13) & "File Path:" & Chr(13) & FilePath & Chr(13) & Chr(13) & "Function:" & Chr(13) & "GetInfo()", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Error")
End
End Try
FileClose(1)
Return TempTask
End Function
End Module
Function GetTaskList() As TaskInfo()
Dim TempList() As TaskInfo
Dim i As Long
Dim Size As Long
Dim FileList() As String
ReDim TempList(0 To CLng("&HFFFFFF"))
FileList = System.IO.Directory.GetFiles(Application.StartupPath & "\task\")
For i = 0 To UBound(FileList) - 1
If System.IO.Path.GetExtension(FileList(i)) = ".qed" Then
TempList(Size) = GetInfo(FileList(i))
Size = Size + 1
End If
Next
ReDim Preserve TempList(0 To Size)
Return TempList
End Function
Function GetTaskList() As TaskItem()
Dim TempTaskList() As TaskItem
Dim i As Long
Dim Size As Long
Dim FileList() As String
FileList = System.IO.Directory.GetFiles(Application.StartupPath & "\task\")
ReDim TempTaskList(0 To UBound(FileList))
For i = 0 To UBound(FileList) - 1
If System.IO.Path.GetExtension(FileList(i)) = ".qed" Then
TempTaskList(Size).FileName = FileList(i)
TempTaskList(Size).TaskInfo = GetInfo(FileList(i))
Size = Size + 1
End If
Next
ReDim Preserve TempTaskList(0 To Size)
Return TempTaskList
End Function