Esempio n. 1
0
        public override void SetListenerSpecificData(ListenerTriggeredEventArgs eventArgs)
        {
            base.SetListenerSpecificData(eventArgs);
            string FullFileName = DataToPass["ImpactedFullFileOrFolderName"].ToString();

            if (File.Exists(FullFileName))
            {
                if (!FilePositions.ContainsKey(FullFileName))
                {
                    FilePositions.Add(FullFileName, 0);
                }
                using (FileStream _textReader = new FileStream(FullFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    _textReader.Seek(FilePositions[FullFileName], SeekOrigin.Begin);
                    using (StreamReader sr = new StreamReader(_textReader))
                    {
                        eventArgs.Data["AdditionalContent"] = sr.ReadToEnd();
                        FilePositions[FullFileName]         = _textReader.Position;
                    }
                }
            }
            else
            {
                FilePositions.Remove(FullFileName);
            }
        }
Esempio n. 2
0
 public virtual void SetListenerSpecificData(ListenerTriggeredEventArgs eventArgs)
 {
     _triggeredCount        += 1;
     eventArgs.Data["RunID"] = _triggeredCount;
     foreach (KeyValuePair <string, object> kvPair in DataToPass)
     {
         eventArgs.Data[kvPair.Key] = kvPair.Value;
     }
 }
Esempio n. 3
0
        public void TriggerEvent()
        {
            EventHandler <ListenerTriggeredEventArgs> handler = OnTriggered;

            if (handler != null)
            {
                ListenerTriggeredEventArgs e = new ListenerTriggeredEventArgs()
                {
                    Listener = this, Originator = _originator, TimeTriggered = DateTime.Now, Data = new Dictionary <string, object>(StringComparer.CurrentCultureIgnoreCase)
                };
                SetListenerSpecificData(e);
                handler(this, e);
            }
        }
Esempio n. 4
0
 public override void SetListenerSpecificData(ListenerTriggeredEventArgs eventArgs)
 {
     base.SetListenerSpecificData(eventArgs);
     eventArgs.Data["DayOfWeek"] = DateTime.Now.DayOfWeek.ToString();
 }
Esempio n. 5
0
 public override void SetListenerSpecificData(ListenerTriggeredEventArgs eventArgs)
 {
     base.SetListenerSpecificData(eventArgs);
     eventArgs.Data["AdditionalContent"] = new StreamReader(_textReader).ReadToEnd();
     _textReader.Seek(0, SeekOrigin.End);
 }