/// <summary> /// Constructor por defecto /// </summary> public FileChangeInput() : base() { RaiseMode = new DataInputEventListener() { EventName = "FileChangeInput", }; Encoding = SerializationHelper.EEncoding.UTF8; DesignBackColor = Color.Green; }
void W_Changed(object sender, IO.FileSystemEventArgs e) { if (Interlocked.Read(ref IsTrying) == 1) { return; } // Lanzar el evento if (RaiseMode is DataInputEventListener) { DataInputEventListener ev = (DataInputEventListener)RaiseMode; ev.RaiseTrigger(e); } }
/// <summary> /// Constructor por defecto /// </summary> public EventLogInput() : base() { MachineName = "."; CategoryNumber = -1; GetErrors = true; GetWarnings = true; GetInformations = true; GetSuccessAudits = true; GetFailureAudits = true; DesignBackColor = Color.DeepPink; RaiseMode = new DataInputEventListener() { EventName = "EventLogInput", }; }
void _Logger_EntryWritten(object sender, EntryWrittenEventArgs e) { if (CategoryNumber != -1 && e.Entry.CategoryNumber == CategoryNumber) { return; } if (RegexMessage != null) { if (!RegexMessage.IsMatch(e.Entry.Message)) { return; } } if (RegexUser != null) { if (!RegexUser.IsMatch(e.Entry.UserName)) { return; } } if ((GetErrors && e.Entry.EntryType.HasFlag(EventLogEntryType.Error)) || (GetWarnings && e.Entry.EntryType.HasFlag(EventLogEntryType.Warning)) || (GetInformations && e.Entry.EntryType.HasFlag(EventLogEntryType.Information)) || (GetSuccessAudits && e.Entry.EntryType.HasFlag(EventLogEntryType.SuccessAudit)) || (GetFailureAudits && e.Entry.EntryType.HasFlag(EventLogEntryType.FailureAudit)) ) { l.Add(new Log(e.Entry)); } // Lanzar el evento if (RaiseMode is DataInputEventListener) { DataInputEventListener ev = (DataInputEventListener)RaiseMode; ev.RaiseTrigger(e); } }
void C_OnMessage(object sender, MessageEventArgs e) { bool ok = AvailableUsers == null || AvailableUsers.Length <= 0; if (!ok) { foreach (string s in AvailableUsers) { if (s == e.Message.From.Username) { ok = true; break; } } } if (!ok) { _Bot.Value.SendMessage(MessageNotUserAvailable, MessageMode, null, e.Message.Chat.Id); return; } string text = e.Message.Text; if (!string.IsNullOrEmpty(text)) { if (text == SubscribePassword) { _Bot.Value.AllowedChatsAdd(e.Message.Chat.Id); _Bot.Value.AllowedChatsSave(FileChatStore); _Bot.Value.SendMessage(MessageWrongPassword, MessageMode, RetKey(true), e.Message.Chat.Id); } else { if (_Bot.Value.AllowedChatsContains(e.Message.Chat.Id)) { if (text.ToLowerInvariant() == "/stop") { _Bot.Value.AllowedChatsRemove(e.Message.Chat.Id); _Bot.Value.AllowedChatsSave(FileChatStore); _Bot.Value.SendMessage(MessageUnsubscribe, MessageMode, RetKey(false), e.Message.Chat.Id); return; } } } if (Events != null && _Bot.Value.AllowedChatsContains(e.Message.Chat.Id)) { foreach (TelegramAction ev in Events) { if (text == ev.UserInput) { if (!string.IsNullOrEmpty(ev.EventName)) { DataInputEventListener.RaiseEvent(this, ev.EventName, null); } if (!string.IsNullOrEmpty(ev.SendText)) { _Bot.Value.SendMessage(ev.SendText, MessageMode, null, e.Message.Chat.Id); } return; } } } } if (_Bot.Value.AllowedChatsContains(e.Message.Chat.Id)) { _Bot.Value.SendMessage(MessageAlreadySubscribed, MessageMode, RetKey(true), e.Message.Chat.Id); } else { _Bot.Value.SendMessage(MessageNotSubscribed, MessageMode, RetKey(false), e.Message.Chat.Id); } }
/// <summary> /// Saca el contenido de los datos a un archivo /// </summary> /// <param name="data">Datos</param> /// <param name="state">Estado de la enumeración</param> protected override IData OnProcessData(IData data, EEnumerableDataState state) { DataInputEventListener.RaiseEvent(this, EventName, AttachData ? data : null); return(data); }