コード例 #1
0
ファイル: EventLog.cs プロジェクト: pmq20/mono_forked
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: EventLog.cs プロジェクト: pmq20/mono_forked
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 internal EventLogEntryEnumerator(EventLogImpl impl)
 {
     _impl = impl;
 }
コード例 #8
0
 internal EventLogEntryCollection(EventLogImpl impl)
 {
     _impl = impl;
 }
コード例 #9
0
        public static EventLog[] GetEventLogs(string machineName)
        {
            EventLogImpl impl = CreateEventLogImpl(new EventLog());

            return(impl.GetEventLogs(machineName));
        }
コード例 #10
0
ファイル: EventLog.cs プロジェクト: sushihangover/playscript
		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);
		}
コード例 #11
0
			internal EventLogEntryEnumerator (EventLogImpl impl)
			{
				_impl = impl;
			}
コード例 #12
0
		internal EventLogEntryCollection(EventLogImpl impl)
		{
			_impl = impl;
		}