Skip to content

Commit fcb5494

Browse files
committed
Initial commit.. Pushing to github.. Needs performance improvements and some refactoring..
0 parents  commit fcb5494

File tree

158 files changed

+6471
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+6471
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.suo
2+
*.user
3+
*.sln.cache
4+
*.resharper
5+
_ReSharper.*
6+
bin
7+
obj
8+
Debug
9+
Release

Console Client/.svn/dir-prop-base

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
K 10
2+
svn:ignore
3+
V 15
4+
bin
5+
obj
6+
*.user
7+
8+
END

Console Client/.svn/entries

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
8
2+
3+
dir
4+
124
5+
svn://localhost/EventLogAnalyzer/Console%20Client
6+
svn://localhost
7+
8+
9+
10+
2007-07-30T12:34:44.292290Z
11+
124
12+
pal
13+
has-props
14+
15+
svn:special svn:externals svn:needs-lock
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
168c17fe-db3f-4e4d-a451-3460bad92810
28+
29+
InputFilterArguments.cs
30+
file
31+
32+
33+
34+
35+
2007-07-26T19:47:59.406250Z
36+
f5a071c07ef169e1875d9ddbb2968f8c
37+
2007-07-26T19:54:33.890625Z
38+
110
39+
pal
40+
41+
Console Client.csproj
42+
file
43+
125
44+
45+
46+
47+
2007-08-01T10:43:16.437500Z
48+
3f1aa6ff26e6216b914c12f1bf6b1d0f
49+
2007-08-01T11:20:29.390625Z
50+
125
51+
pal
52+
53+
FuzzyComparer
54+
dir
55+
56+
OutputFilterArguments.cs
57+
file
58+
59+
60+
61+
62+
2007-07-27T06:21:17.356716Z
63+
2987a7884ef97a80053c90d265331af4
64+
2007-07-27T06:40:21.229664Z
65+
112
66+
pal
67+
68+
ILogRecordClassifier.cs
69+
file
70+
125
71+
72+
73+
74+
2007-08-01T10:42:56.140625Z
75+
5e54e81d517af0ba38df44fdc947764f
76+
2007-08-01T11:20:29.390625Z
77+
125
78+
pal
79+
80+
Filters
81+
dir
82+
83+
ProcessControlArguments.cs
84+
file
85+
86+
87+
88+
89+
2007-07-24T20:16:59.343750Z
90+
866bd9b7ec855ce2c74e8aaf823ab299
91+
2007-07-24T20:20:48.421875Z
92+
106
93+
pal
94+
95+
Reporting
96+
dir
97+
98+
LogRecordClassifier.cs
99+
file
100+
125
101+
102+
103+
104+
105+
106+
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
117+
118+
119+
120+
deleted
121+
122+
CLI.cs
123+
file
124+
126
125+
126+
127+
128+
2007-08-02T05:58:49.826926Z
129+
353c459a75068f189ff886474e0a6bcc
130+
2007-08-02T05:58:57.607977Z
131+
126
132+
pal
133+
134+
CommandLineArgumentHandler.cs
135+
file
136+
137+
138+
139+
140+
2007-07-26T20:29:17.953125Z
141+
ac42a317d10be5d6c3aeffbda9905689
142+
2007-07-26T20:35:41.515625Z
143+
111
144+
pal
145+
146+
EventLogRecordClassifier.cs
147+
file
148+
125
149+
150+
151+
152+
2007-08-01T11:19:04.859375Z
153+
049c01e9101b12b41a1d7514b7f6034b
154+
2007-08-01T11:20:29.390625Z
155+
125
156+
pal
157+
158+
Properties
159+
dir
160+

Console Client/.svn/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using pal.EventLog;
4+
using pal.EventLogAnalyzer.ConsoleClient.Properties;
5+
using pal.EventLogAnalyzer.ConsoleClient.Reporting;
6+
7+
namespace pal.EventLogAnalyzer.ConsoleClient
8+
{
9+
public class CLI
10+
{
11+
private static readonly List<IEventLogRecord> _filteredRecords = new List<IEventLogRecord>();
12+
private static readonly EventLogFileCollection _inputFiles = new EventLogFileCollection();
13+
14+
public static void Main(string[] args)
15+
{
16+
#region Extract Arguments
17+
18+
if (args.Length == 0) printHelpAndExit();
19+
20+
CommandLineArgumentHandler argumentHandler = new CommandLineArgumentHandler();
21+
for (int i = 0; i < args.Length; i += 2)
22+
{
23+
if (args[i].ToLower().Contains("help"))
24+
{
25+
printHelpAndExit();
26+
}
27+
28+
if (argumentHandler.IsKnown(args[i]))
29+
argumentHandler.PickArgument(args[i], args[i + 1]);
30+
else
31+
{
32+
IEventLogFile eventLogFile = new EventLogFileFactory(args[i]).EventLogFile;
33+
eventLogFile.Parse();
34+
_inputFiles.Add(eventLogFile);
35+
}
36+
}
37+
38+
#endregion
39+
40+
#region Apply Input Filters
41+
42+
foreach (IEventLogRecord eventLogRecord in _inputFiles)
43+
{
44+
if (argumentHandler.Filters.Filter(eventLogRecord))
45+
_filteredRecords.Add(eventLogRecord);
46+
}
47+
48+
#endregion
49+
50+
disposeAllInputFilesToReduceMemoryFootprint();
51+
52+
#region Auto-classify filtered records
53+
54+
EventLogRecordClassifier classifier = new EventLogRecordClassifier();
55+
classifier.Classify(_filteredRecords, argumentHandler.ProcessArguments.ToleranceMargin);
56+
57+
#endregion
58+
59+
#region Generate reports
60+
61+
ReportGenerator reportGenerator =
62+
new ReportGenerator(argumentHandler.OutputArguments.OutputFolder,
63+
argumentHandler.OutputArguments.ReportFields);
64+
reportGenerator.WriteReportsFor(classifier.Aggregates);
65+
66+
#endregion
67+
}
68+
69+
private static void disposeAllInputFilesToReduceMemoryFootprint()
70+
{
71+
_inputFiles.Dispose();
72+
}
73+
74+
private static void printHelpAndExit()
75+
{
76+
Console.Out.WriteLine(Resources.HelpText);
77+
Environment.Exit(1);
78+
}
79+
}
80+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
3+
namespace pal.EventLogAnalyzer.ConsoleClient
4+
{
5+
internal class CommandLineArgumentHandler
6+
{
7+
private readonly InputFilterArguments _inputFilterArguments;
8+
private readonly OutputFilterArguments _outputArguments;
9+
private readonly ProcessControlArguments _processControlArguments;
10+
11+
public CommandLineArgumentHandler()
12+
{
13+
//TODO: Still to handle mandatory arguments
14+
_inputFilterArguments = new InputFilterArguments();
15+
_outputArguments = new OutputFilterArguments();
16+
_processControlArguments = new ProcessControlArguments();
17+
}
18+
19+
public InputFilterArguments Filters
20+
{
21+
get { return _inputFilterArguments; }
22+
}
23+
24+
public ProcessControlArguments ProcessArguments
25+
{
26+
get { return _processControlArguments; }
27+
}
28+
29+
public OutputFilterArguments OutputArguments
30+
{
31+
get { return _outputArguments; }
32+
}
33+
34+
public void PickArgument(string argumentSwitch, string argumentParameter)
35+
{
36+
if (!IsKnown(argumentSwitch))
37+
throw new Exception();
38+
39+
//TODO: BaseArgumentType for all three types of arguments?
40+
41+
if (_inputFilterArguments.IsKnown(argumentSwitch))
42+
{
43+
_inputFilterArguments.Add(argumentSwitch, argumentParameter);
44+
}
45+
46+
if (_outputArguments.IsKnown(argumentSwitch))
47+
{
48+
_outputArguments.Add(argumentSwitch, argumentParameter);
49+
return;
50+
}
51+
52+
if (_processControlArguments.IsKnown(argumentSwitch))
53+
{
54+
_processControlArguments.Add(argumentSwitch, argumentParameter);
55+
}
56+
}
57+
58+
public bool IsKnown(string @switch)
59+
{
60+
return _inputFilterArguments.IsKnown(@switch)
61+
|| _outputArguments.IsKnown(@switch)
62+
|| _processControlArguments.IsKnown(@switch);
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)