public static bool SourceExists(string source, string machineName) { if (machineName == null || machineName.Trim().Length == 0) { throw new ArgumentException(string.Format( CultureInfo.InvariantCulture, "Invalid value '{0}' for" + " parameter 'machineName'.", machineName)); } EventLogImpl impl = CreateEventLogImpl(string.Empty, machineName, source); return(impl.SourceExists(source, machineName)); }
public static string LogNameFromSourceName(string source, string machineName) { if (machineName == null || machineName.Trim().Length == 0) #if NET_2_0 { throw new ArgumentException(string.Format( CultureInfo.InvariantCulture, "Invalid value '{0}' for" + " parameter 'MachineName'.", machineName)); } #else { throw new ArgumentException(string.Format( CultureInfo.InvariantCulture, "Invalid value {0} for" + " parameter MachineName.", machineName)); } #endif EventLogImpl impl = CreateEventLogImpl(string.Empty, machineName, source); return(impl.LogNameFromSourceName(source, machineName)); }
public static bool Exists(string logName, string machineName) { if (machineName == null || machineName.Trim().Length == 0) { throw new ArgumentException("Invalid format for argument machineName."); } if (logName == null || logName.Length == 0) { return(false); } EventLogImpl impl = CreateEventLogImpl(logName, machineName, string.Empty); return(impl.Exists(logName, machineName)); }
public static void Delete(string logName, string machineName) { if (machineName == null || machineName.Trim().Length == 0) { throw new ArgumentException("Invalid format for argument" + " machineName."); } if (logName == null || logName.Length == 0) { throw new ArgumentException("Log to delete was not specified."); } EventLogImpl impl = CreateEventLogImpl(logName, machineName, string.Empty); impl.Delete(logName, machineName); }
public EventLog(string logName, string machineName, string source) { if (logName == null) { throw new ArgumentNullException("logName"); } if (machineName == null || machineName.Trim().Length == 0) { throw new ArgumentException(string.Format( CultureInfo.InvariantCulture, "Invalid value '{0}' for" + " parameter 'machineName'.", machineName)); } this.source = source; this.machineName = machineName; this.logName = logName; Impl = CreateEventLogImpl(this); }
static void CreateEventSource(EventSourceCreationData sourceData) { if (sourceData.Source == null || sourceData.Source.Length == 0) { throw new ArgumentException("Source property value has not been specified."); } if (sourceData.LogName == null || sourceData.LogName.Length == 0) { throw new ArgumentException("Log property value has not been specified."); } if (SourceExists(sourceData.Source, sourceData.MachineName)) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Source '{0}' already exists on '{1}'.", sourceData.Source, sourceData.MachineName)); } EventLogImpl impl = CreateEventLogImpl(sourceData.LogName, sourceData.MachineName, sourceData.Source); impl.CreateEventSource(sourceData); }
internal EventLogEntryEnumerator(EventLogImpl impl) { _impl = impl; }
internal EventLogEntryCollection(EventLogImpl impl) { _impl = impl; }
public static EventLog[] GetEventLogs(string machineName) { EventLogImpl impl = CreateEventLogImpl(new EventLog()); return(impl.GetEventLogs(machineName)); }
public EventLog(string logName, string machineName, string source) { if (logName == null) { throw new ArgumentNullException ("logName"); } if (machineName == null || machineName.Trim ().Length == 0) throw new ArgumentException (string.Format ( CultureInfo.InvariantCulture, "Invalid value '{0}' for" + " parameter 'machineName'.", machineName)); this.source = source; this.machineName = machineName; this.logName = logName; Impl = CreateEventLogImpl (this); }
internal EventLogEntryEnumerator (EventLogImpl impl) { _impl = impl; }