コード例 #1
0
 /// <summary>
 /// Raises the eventLogEntryWritten event to listeners
 /// </summary>
 /// <param name="e"></param>
 private void OnEntryWritten(EventLogEntry e)
 {
     if (this.EntryWritten != null)
     {
         this.EntryWritten(this, e);
     }
 }
コード例 #2
0
        /// <summary>
        /// Loads the eventlog entry collection
        /// </summary>
        private void LoadEventLogEntryCollection()
        {
            //This is only called when the log is changed and when the class is instantiated so it's pretty safe
            //to re-init the collection
            this.eventLogEntryCollection = new EventLogEntryCollection();
            string[] attributes = new string[] { "machineName", "userName", "timeGenerated",
                                                 "source", "message", "eventLogEntryType",
                                                 "eventID", "category", "rawData", "id", "timeWritten", "index" };

            //Get all the eventLog nodes
            foreach (XmlNode node in this.nodeLog.ChildNodes)
            {
                string            machineName   = node.Attributes.GetNamedItem(attributes[0]).Value;
                string            userName      = node.Attributes.GetNamedItem(attributes[1]).Value;
                DateTime          timeGenerated = DateTime.Parse(node.Attributes.GetNamedItem(attributes[2]).Value);
                string            source        = node.Attributes.GetNamedItem(attributes[3]).Value;
                string            message       = node.Attributes.GetNamedItem(attributes[4]).Value;
                EventLogEntryType type          = (EventLogEntryType)Int32.Parse(node.Attributes.GetNamedItem(attributes[5]).Value);
                int    eventID  = Int32.Parse(node.Attributes.GetNamedItem(attributes[6]).Value);
                short  category = Int16.Parse(node.Attributes.GetNamedItem(attributes[7]).Value);
                string srawData = node.Attributes.GetNamedItem(attributes[8]).Value;
                byte[] rawData  = new byte[0];
                if (srawData.Length > 0)
                {
                    rawData = Convert.FromBase64String(srawData);
                }
                string   id          = node.Attributes.GetNamedItem(attributes[9]).Value;
                DateTime timeWritten = DateTime.Parse(node.Attributes.GetNamedItem(attributes[10]).Value);
                int      index       = Int32.Parse(node.Attributes.GetNamedItem(attributes[11]).Value);

                //Add to the collection
                EventLogEntry eventLogEntry = new EventLogEntry(category, rawData, type, eventID, index, machineName, message, source, timeGenerated, timeWritten, userName, id);
                this.eventLogEntryCollection.Add(eventLogEntry);
            }
        }
コード例 #3
0
ファイル: EventLog.cs プロジェクト: scryed001/gpstranslator
 /// <summary>
 /// Notifies any listeners that an entry was written to the log
 /// </summary>
 /// <param name="e">the entry item that was written to the log</param>
 private void OnEntryWritten(EventLogEntry e)
 {
     if (this.enableRaisingEvents)
     {
         if (EntryWritten != null)
         {
             EntryWritten(this, e);
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// Add an eventlog entry to the collection
 /// </summary>
 /// <param name="eventLogEntry"></param>
 /// <returns></returns>
 public int Add(EventLogEntry eventLogEntry)
 {
     if (this.List.Contains(eventLogEntry))
     {
         return(this.List.IndexOf(eventLogEntry));
     }
     else
     {
         return(this.List.Add(eventLogEntry));
     }
 }
コード例 #5
0
		/// <summary>
		/// Raises the eventLogEntryWritten event to listeners
		/// </summary>
		/// <param name="e"></param>
		private void OnEntryWritten(EventLogEntry e)
		{
			if(this.EntryWritten!=null)
				this.EntryWritten(this,e);
		}
コード例 #6
0
		/// <summary>
		/// Loads the eventlog entry collection
		/// </summary>
		private void LoadEventLogEntryCollection()
		{
			//This is only called when the log is changed and when the class is instantiated so it's pretty safe
			//to re-init the collection
			this.eventLogEntryCollection = new EventLogEntryCollection();
			string[] attributes = new string[]{"machineName","userName","timeGenerated",
												  "source","message","eventLogEntryType",
												  "eventID","category","rawData","id","timeWritten","index"};

			//Get all the eventLog nodes
			foreach(XmlNode node in this.nodeLog.ChildNodes)
			{
				string machineName = node.Attributes.GetNamedItem(attributes[0]).Value;
				string userName = node.Attributes.GetNamedItem(attributes[1]).Value;
				DateTime timeGenerated = DateTime.Parse(node.Attributes.GetNamedItem(attributes[2]).Value);
				string source = node.Attributes.GetNamedItem(attributes[3]).Value;
				string message = node.Attributes.GetNamedItem(attributes[4]).Value;
				EventLogEntryType type = (EventLogEntryType)Int32.Parse(node.Attributes.GetNamedItem(attributes[5]).Value);
				int eventID = Int32.Parse(node.Attributes.GetNamedItem(attributes[6]).Value);
				short category = Int16.Parse(node.Attributes.GetNamedItem(attributes[7]).Value);
				string srawData = node.Attributes.GetNamedItem(attributes[8]).Value;
				byte[] rawData = new byte[0];
				if(srawData.Length > 0)
					rawData = Convert.FromBase64String(srawData);
				string id = node.Attributes.GetNamedItem(attributes[9]).Value;
				DateTime timeWritten = DateTime.Parse(node.Attributes.GetNamedItem(attributes[10]).Value);
				int index = Int32.Parse(node.Attributes.GetNamedItem(attributes[11]).Value);
			
				//Add to the collection
				EventLogEntry eventLogEntry = new EventLogEntry(category,rawData,type,eventID,index,machineName,message,source,timeGenerated,timeWritten,userName,id);
				this.eventLogEntryCollection.Add(eventLogEntry);
			}
		}
コード例 #7
0
ファイル: EventLog.cs プロジェクト: scryed001/gpstranslator
 /// <summary>
 /// Handler for the entry written event in the eventLogWriter
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void eventLogWriter_EntryWritten(object sender, EventLogEntry e)
 {
     this.OnEntryWritten(e);
 }
コード例 #8
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public EntryWrittenEventArgs(EventLogEntry eventLogEntry)
 {
     this.eventLogEntry = eventLogEntry;
 }
コード例 #9
0
		/// <summary>
		/// Default constructor
		/// </summary>
		public EntryWrittenEventArgs(EventLogEntry eventLogEntry)
		{
			this.eventLogEntry = eventLogEntry;
		}
コード例 #10
0
		/// <summary>
		/// Handler for the entry written event in the eventLogWriter
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void eventLogWriter_EntryWritten(object sender, EventLogEntry e)
		{
			this.OnEntryWritten(e);
		}
コード例 #11
0
		/// <summary>
		/// Notifies any listeners that an entry was written to the log
		/// </summary>
		/// <param name="e">the entry item that was written to the log</param>
		private void OnEntryWritten(EventLogEntry e)
		{
			if(this.enableRaisingEvents)
			{
				if(EntryWritten!=null)
					EntryWritten(this,e);
			}
		}