我使用此代码记录鼠标和键盘事件并对其进行回复:
Namespace GlobalMacroRecorder
<Serializable()>
Public Enum MacroEventType
MouseMove
MouseDown
MouseUp
MouseWheel
KeyDown
KeyUp
End Enum
<Serializable()>
Public Class MacroEvent
Public MacroEventType As MacroEventType
Public EventArgs As EventArgs
Public TimeSinceLastEvent As Integer
Public Sub New(ByVal macroEventType As MacroEventType, ByVal eventArgs As EventArgs, ByVal timeSinceLastEvent As Integer)
MyBase.New
Me.MacroEventType = macroEventType
Me.EventArgs = eventArgs
Me.TimeSinceLastEvent = timeSinceLastEvent
End Sub
End Class
End Namespace
我将事件存储在events1:
中Private events1 As List(Of MacroEvent) = New List(Of MacroEvent)
如何将event1保存到文件并再次检索?