15,891,431 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by justin1204 (Top 6 by date)
justin1204
23-Feb-18 5:59am
View
Actually i am reading the event logs from the system(Application, System and Security).Where the logs for each channel(application, system, security) are fetched. it may contain repeated logs, so i need to sort them and show like
Application:
provider name repeated 3 times.
Security:
Provider name1 repeated 10 times,
provider name2 repeated 4 times,
provider name3 once.
system:
provider name1 repeated 4 times,
provider name2 once.
this is the output i want.. if there are multiple entries, they need to be shown in different lines with comma at the end and for the last entry it should end with full stop
am i clear, thanks for your patience
justin1204
23-Feb-18 5:35am
View
ok sure.. and sorry for my unclear comment
logEventDataList = (IList<eventlogsdatatype>)eventLogs.SetChannelType(EventChannelType.Application).SetLogType(EventLogLevel.Error).SetDays(1).GetLogs();
if (logEventDataList.Count > 0)
{
var app = logEventDataList.GroupBy(n => n.Provider).Select(c => new { Key = c.Key, total = c.Count() }).ToList();
if (app.Count > 0)
{
noErrors = false;
result += "Application: \r\n ";
for (int i = 0; i < app.Count(); i++)
{
var item = app[i];
if (item.total > 1 ) result += item.Key + " repeated " + item.total + ((app.Count > 1) ? " times\r\n" : " times");
else result += item.Key + ((app.Count > 1)?" once\r\n" : " once");
result += i == (app.Count() - 1) ? "." : ",";
}
result += Environment.NewLine + Environment.NewLine;
}
}
this is my output after modifying the code:
Application:
SupportAssistAgent repeated 3 times.
System:
Microsoft-Windows-DistributedCOM repeated 10 times
,BTHUSB once
.
comma starts at the start of the second line and full stop in the next line.
justin1204
23-Feb-18 4:49am
View
thanks for the reaply.. yes it worked but the issue is after the first line break if it has a second line, the coma starts at the start of the second line and after the last line, the full stop comes in the next line
justin1204
7-Dec-17 4:47am
View
thankyou Richard, will check that
justin1204
7-Dec-17 4:47am
View
thankyou Jochen for the reply.. sure will check that
justin1204
26-Jun-15 0:44am
View
Thanks for your reply virusstorm.
Actually i need to configure a new profile into the thunderbird programatically ?
Show More