You've already forked YY.EventLogReaderAssistant
mirror of
https://github.com/BDDSM/YY.EventLogReaderAssistant.git
synced 2025-06-30 22:14:05 +02:00
Рефакторинг изменений
- Отказался от усложненной структуры пространств имен - Вынес классы аргументов событий в отдельные файлы - Удалил неиспользуемые пространства имен
This commit is contained in:
@ -5,6 +5,11 @@ VisualStudioVersion = 16.0.30002.166
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YY.EventLogAssistant", "YY.EventLogAssistant\YY.EventLogAssistant.csproj", "{5B2E13F6-9F93-46AA-AB61-7B3A4331840D}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YY.EventLogAssistant", "YY.EventLogAssistant\YY.EventLogAssistant.csproj", "{5B2E13F6-9F93-46AA-AB61-7B3A4331840D}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YY.EventLogAssistantConsoleApp", "YY.EventLogAssistantConsoleApp\YY.EventLogAssistantConsoleApp.csproj", "{9CF3CC92-F793-4398-896A-353DAACC0DE0}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{5B2E13F6-9F93-46AA-AB61-7B3A4331840D} = {5B2E13F6-9F93-46AA-AB61-7B3A4331840D}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -15,6 +20,10 @@ Global
|
|||||||
{5B2E13F6-9F93-46AA-AB61-7B3A4331840D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{5B2E13F6-9F93-46AA-AB61-7B3A4331840D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{5B2E13F6-9F93-46AA-AB61-7B3A4331840D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{5B2E13F6-9F93-46AA-AB61-7B3A4331840D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{5B2E13F6-9F93-46AA-AB61-7B3A4331840D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{5B2E13F6-9F93-46AA-AB61-7B3A4331840D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9CF3CC92-F793-4398-896A-353DAACC0DE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9CF3CC92-F793-4398-896A-353DAACC0DE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9CF3CC92-F793-4398-896A-353DAACC0DE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9CF3CC92-F793-4398-896A-353DAACC0DE0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using YY.LogReader.Models;
|
using YY.EventLogAssistant.Models;
|
||||||
using YY.LogReader.Services;
|
using YY.EventLogAssistant.Services;
|
||||||
using YY.LogReader.Models.EventLog;
|
|
||||||
|
|
||||||
namespace YY.LogReader.EventLog
|
namespace YY.EventLogAssistant
|
||||||
{
|
{
|
||||||
internal sealed class EventLogLGDReader : EventLogReader
|
internal sealed class EventLogLGDReader : EventLogReader
|
||||||
{
|
{
|
||||||
|
@ -5,12 +5,10 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using YY.EventLogAssistant.Models;
|
||||||
using YY.LogReader.Models;
|
using YY.EventLogAssistant.Services;
|
||||||
using YY.LogReader.Models.EventLog;
|
|
||||||
using YY.LogReader.Services;
|
|
||||||
|
|
||||||
namespace YY.LogReader.EventLog
|
namespace YY.EventLogAssistant
|
||||||
{
|
{
|
||||||
internal sealed class EventLogLGFReader : EventLogReader
|
internal sealed class EventLogLGFReader : EventLogReader
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace YY.EventLogAssistant
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace YY.LogReader.EventLog
|
|
||||||
{
|
{
|
||||||
public sealed class EventLogPosition
|
public sealed class EventLogPosition
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
using YY.LogReader.Models.EventLog;
|
using YY.EventLogAssistant.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace YY.LogReader.EventLog
|
namespace YY.EventLogAssistant
|
||||||
{
|
{
|
||||||
public abstract class EventLogReader : IEventLogReader, IDisposable
|
public abstract partial class EventLogReader : IEventLogReader, IDisposable
|
||||||
{
|
{
|
||||||
public static EventLogReader CreateReader(string pathLogFile)
|
public static EventLogReader CreateReader(string pathLogFile)
|
||||||
{
|
{
|
||||||
@ -170,65 +167,5 @@ namespace YY.LogReader.EventLog
|
|||||||
_users.Clear();
|
_users.Clear();
|
||||||
_workServers.Clear();
|
_workServers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class BeforeReadFileEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public BeforeReadFileEventArgs(string fileName)
|
|
||||||
{
|
|
||||||
FileName = fileName;
|
|
||||||
Cancel = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string FileName { get; }
|
|
||||||
public bool Cancel { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class AfterReadFileEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public AfterReadFileEventArgs(string fileName)
|
|
||||||
{
|
|
||||||
FileName = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string FileName { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class BeforeReadEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public BeforeReadEventArgs(string sourceData, long eventNumber)
|
|
||||||
{
|
|
||||||
SourceData = sourceData;
|
|
||||||
EventNumber = eventNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SourceData { get; }
|
|
||||||
public long EventNumber { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class AfterReadEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public AfterReadEventArgs(EventLogRowData rowData, long eventNumber)
|
|
||||||
{
|
|
||||||
RowData = rowData;
|
|
||||||
EventNumber = eventNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EventLogRowData RowData { get; }
|
|
||||||
public long EventNumber { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class OnErrorEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public OnErrorEventArgs(Exception excepton, string sourceData, bool critical)
|
|
||||||
{
|
|
||||||
Exception = excepton;
|
|
||||||
SourceData = sourceData;
|
|
||||||
Critical = critical;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Exception Exception { get; }
|
|
||||||
public string SourceData { get; }
|
|
||||||
public bool Critical { get; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
using YY.EventLogAssistant.Models;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YY.EventLogAssistant
|
||||||
|
{
|
||||||
|
public sealed class AfterReadEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public AfterReadEventArgs(EventLogRowData rowData, long eventNumber)
|
||||||
|
{
|
||||||
|
RowData = rowData;
|
||||||
|
EventNumber = eventNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventLogRowData RowData { get; }
|
||||||
|
public long EventNumber { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YY.EventLogAssistant
|
||||||
|
{
|
||||||
|
public sealed class AfterReadFileEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public AfterReadFileEventArgs(string fileName)
|
||||||
|
{
|
||||||
|
FileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string FileName { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YY.EventLogAssistant
|
||||||
|
{
|
||||||
|
|
||||||
|
public sealed class BeforeReadEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public BeforeReadEventArgs(string sourceData, long eventNumber)
|
||||||
|
{
|
||||||
|
SourceData = sourceData;
|
||||||
|
EventNumber = eventNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SourceData { get; }
|
||||||
|
public long EventNumber { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YY.EventLogAssistant
|
||||||
|
{
|
||||||
|
public sealed class BeforeReadFileEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public BeforeReadFileEventArgs(string fileName)
|
||||||
|
{
|
||||||
|
FileName = fileName;
|
||||||
|
Cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string FileName { get; }
|
||||||
|
public bool Cancel { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YY.EventLogAssistant
|
||||||
|
{
|
||||||
|
public sealed class OnErrorEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public OnErrorEventArgs(Exception excepton, string sourceData, bool critical)
|
||||||
|
{
|
||||||
|
Exception = excepton;
|
||||||
|
SourceData = sourceData;
|
||||||
|
Critical = critical;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Exception Exception { get; }
|
||||||
|
public string SourceData { get; }
|
||||||
|
public bool Critical { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using YY.EventLogAssistant.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using YY.LogReader.Models.EventLog;
|
|
||||||
|
|
||||||
namespace YY.LogReader.EventLog
|
namespace YY.EventLogAssistant
|
||||||
{
|
{
|
||||||
internal interface IEventLogReader
|
internal interface IEventLogReader
|
||||||
{
|
{
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
using YY.LogReader.Models.EventLog;
|
using YY.EventLogAssistant.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using YY.EventLogAssistant.Services;
|
||||||
using YY.LogReader.Services;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Data.SQLite;
|
|
||||||
|
|
||||||
namespace YY.LogReader.EventLog
|
namespace YY.EventLogAssistant
|
||||||
{
|
{
|
||||||
internal sealed class LogParserLGF
|
internal sealed class LogParserLGF
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class Applications
|
public class Applications
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class Computers
|
public class Computers
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class EventLogRowData : RowData
|
public class EventLogRowData : RowData
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class Events
|
public class Events
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class InformationSystems
|
public class InformationSystems
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class Metadata
|
public class Metadata
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class PrimaryPorts
|
public class PrimaryPorts
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using YY.LogReader.Models.EventLog;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public abstract class RowData
|
public abstract class RowData
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class SecondaryPorts
|
public class SecondaryPorts
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace YY.EventLogAssistant.Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
|
||||||
{
|
{
|
||||||
public enum Severity
|
public enum Severity
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace YY.EventLogAssistant.Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
|
||||||
{
|
{
|
||||||
public enum TransactionStatus
|
public enum TransactionStatus
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class Users
|
public class Users
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace YY.LogReader.Models.EventLog
|
namespace YY.EventLogAssistant.Models
|
||||||
{
|
{
|
||||||
public class WorkServers
|
public class WorkServers
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data.SqlTypes;
|
using System.Data.SqlTypes;
|
||||||
|
|
||||||
namespace YY.LogReader.Services
|
namespace YY.EventLogAssistant.Services
|
||||||
{
|
{
|
||||||
internal static class DateTimeExtensions
|
internal static class DateTimeExtensions
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace YY.LogReader.Services
|
namespace YY.EventLogAssistant.Services
|
||||||
{
|
{
|
||||||
internal static class IntExtensions
|
internal static class IntExtensions
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace YY.LogReader.Services
|
namespace YY.EventLogAssistant.Services
|
||||||
{
|
{
|
||||||
internal static class SQLiteExtensions
|
internal static class SQLiteExtensions
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace YY.LogReader.Services
|
namespace YY.EventLogAssistant.Services
|
||||||
{
|
{
|
||||||
internal class StreamLineReader : IDisposable
|
internal class StreamLineReader : IDisposable
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace YY.LogReader.Services
|
namespace YY.EventLogAssistant.Services
|
||||||
{
|
{
|
||||||
internal static class StreamReaderExtensions
|
internal static class StreamReaderExtensions
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace YY.LogReader.Services
|
namespace YY.EventLogAssistant.Services
|
||||||
{
|
{
|
||||||
internal static class StringExtensions
|
internal static class StringExtensions
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using YY.EventLogAssistant;
|
||||||
|
using YY.EventLogAssistant.Models;
|
||||||
|
|
||||||
|
namespace YY.EventLogAssistantConsoleApp
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
private static int _eventNumber = 0;
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
string testDataDirectoryPath = $"{ Environment.CurrentDirectory}{Path.DirectorySeparatorChar}TestData\\1Cv8.lgf";
|
||||||
|
|
||||||
|
EventLogReader reader = EventLogReader.CreateReader(testDataDirectoryPath);
|
||||||
|
reader.AfterReadEvent += Reader_AfterReadEvent;
|
||||||
|
reader.AfterReadFile += Reader_AfterReadFile;
|
||||||
|
reader.BeforeReadEvent += Reader_BeforeReadEvent;
|
||||||
|
reader.BeforeReadFile += Reader_BeforeReadFile;
|
||||||
|
reader.OnErrorEvent += Reader_OnErrorEvent;
|
||||||
|
|
||||||
|
// Пример задания точного положения для чтения в файле. Для формата *.lgf
|
||||||
|
//reader.SetCurrentPosition(new EventLogPosition(
|
||||||
|
// 5,
|
||||||
|
// reader.LogFilePath,
|
||||||
|
// reader.LogFilePath,
|
||||||
|
// 436));
|
||||||
|
|
||||||
|
Console.WriteLine($"Всего событий: {reader.Count()}");
|
||||||
|
|
||||||
|
long totalEvents = 0;
|
||||||
|
EventLogRowData rowData;
|
||||||
|
while (reader.Read(out rowData))
|
||||||
|
totalEvents += 1;
|
||||||
|
|
||||||
|
Console.WriteLine("Для выхода нажмите любую клавишу...");
|
||||||
|
Console.ReadKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Reader_BeforeReadFile(EventLogReader sender, BeforeReadFileEventArgs args)
|
||||||
|
{
|
||||||
|
// Пример получения текущей позиции чтения
|
||||||
|
var positionBeforeReadFile = sender.GetCurrentPosition();
|
||||||
|
|
||||||
|
Console.WriteLine("Reader_BeforeReadFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Reader_AfterReadFile(EventLogReader sender, AfterReadFileEventArgs args)
|
||||||
|
{
|
||||||
|
// Пример получения текущей позиции чтения
|
||||||
|
var positionAfterReadFile = sender.GetCurrentPosition();
|
||||||
|
|
||||||
|
Console.WriteLine("Reader_AfterReadFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Reader_BeforeReadEvent(EventLogReader sender, BeforeReadEventArgs args)
|
||||||
|
{
|
||||||
|
_eventNumber += 1;
|
||||||
|
Console.WriteLine($"Reader_BeforeReadEvent: {_eventNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Reader_AfterReadEvent(EventLogReader sender, AfterReadEventArgs args)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Reader_AfterReadEvent {_eventNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Reader_OnErrorEvent(EventLogReader sender, OnErrorEventArgs args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Reader_OnErrorEvent");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\YY.EventLogAssistant\YY.EventLogAssistant.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Reference in New Issue
Block a user