我想写事件日志。我已经执行了查询。并返回预期的结果。现在,我想在evtx文件中写入该结果。
这是我的代码:
List<EventRecord> eventList = new List<EventRecord>();
for (EventRecord eventInstance = logReader.ReadEvent();
eventInstance != null; eventInstance = logReader.ReadEvent())
{
eventList.Add(eventInstance);
}
如何传递此eventList以用evtx文件格式写入。
答案 0 :(得分:2)
我提到下面的代码来划分事件:
eventRecordList = null;
remoteEventRecordList = Xmlcollection.Cast<Control.Common.Enums.EventViewerDetails>().ToList();
var distinctLevels = (from row in remoteEventRecordList.AsEnumerable()
let value = row.Level
select value).Distinct();
foreach (var remoteItem in distinctLevels)
{
if (!AvailbleFilterOptionsObservableCollection.Any(i => i.Name == GetLevelName(Convert.ToByte(remoteItem))))
{
AvailbleFilterOptionsObservableCollection.Add(new FilteredData
{
Name = GetLevelName(Convert.ToByte(remoteItem)),
Level = Convert.ToByte(remoteItem),
IsSelected = true
});
}
}