Advertisement
tankcr

Untitled

Jun 4th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Diagnostics;
  7.  
  8. namespace SysTools
  9. {
  10.     public class Logs
  11.     {
  12.         string logName;
  13.  
  14.         public string LogName
  15.         {
  16.             get { return logName; }
  17.             set { logName = value; }
  18.         }
  19.  
  20.         public Logs()
  21.         {
  22.  
  23.         }
  24.     }
  25.     public class GetLogs
  26.     {
  27.         public static List<Logs> GetLogNames(string computername)
  28.         {
  29.             List<Logs> logs = new List<Logs>();
  30.             GetLogs LogNames = new GetLogs();
  31.             EventLog[] remoteEventLogs;
  32.             remoteEventLogs = EventLog.GetEventLogs(computername);
  33.             Logs log = new Logs();
  34.             foreach (EventLog e in remoteEventLogs)
  35.             {
  36.                 log.LogName = e.LogDisplayName;
  37.                 logs.Add(log);
  38.             }
  39.             return logs;
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement