public CooldownHandler([NotNull] ILogger logger, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, Guid?soundId = null, string messageTitle = null, string messageContent = null, bool messagePersist = false) { if (logger == null) { throw new ArgumentNullException("logger"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } handler = new NotifyHandler(logger, soundManager, trayPopups) { SoundId = (soundId ?? Guid.Empty), Title = (messageTitle ?? string.Empty), Message = (messageContent ?? string.Empty) }; if (messagePersist) { handler.PopupPersistent = true; } }
public WurmTimer( string persistentObjectId, [NotNull] ITrayPopups trayPopups, [NotNull] ILogger logger, [NotNull] IWurmApi wurmApi, [NotNull] ISoundManager soundManager, [NotNull] ITelemetry telemetry) : base(persistentObjectId) { Id = Guid.Parse(persistentObjectId); if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } if (logger == null) { throw new ArgumentNullException("logger"); } if (wurmApi == null) { throw new ArgumentNullException("wurmApi"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } this.TrayPopups = trayPopups; this.Logger = logger; this.WurmApi = wurmApi; this.SoundManager = soundManager; this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry)); }
public ActiveTriggers( string characterName, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] IActionQueueConditions actionQueueConditions, [NotNull] TriggersDataContext triggersDataContext, [NotNull] ITelemetry telemetry) { if (soundManager == null) { throw new ArgumentNullException(nameof(soundManager)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (wurmApi == null) { throw new ArgumentNullException(nameof(wurmApi)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (actionQueueConditions == null) { throw new ArgumentNullException(nameof(actionQueueConditions)); } if (triggersDataContext == null) { throw new ArgumentNullException(nameof(triggersDataContext)); } CharacterName = characterName; this.soundManager = soundManager; this.trayPopups = trayPopups; this.wurmApi = wurmApi; this.logger = logger; this.actionQueueConditions = actionQueueConditions; this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry)); this.triggersConfig = triggersDataContext.CharacterTriggersConfigs.GetOrCreate(characterName); foreach (var entity in triggersConfig.TriggerEntities.Values) { try { triggers.Add(entity.TriggerId, BuildTrigger(entity)); } catch (Exception exception) { logger.Error(exception, string.Format("Error initializing trigger id {0}, name: {1}", entity.TriggerId, entity.Name)); } } }
public CalendarFeature( [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] ITimerFactory timerFactory, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, [NotNull] WurmSeasonsManager seasonsManager) { if (wurmApi == null) { throw new ArgumentNullException(nameof(wurmApi)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (timerFactory == null) { throw new ArgumentNullException(nameof(timerFactory)); } if (soundManager == null) { throw new ArgumentNullException(nameof(soundManager)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (seasonsManager == null) { throw new ArgumentNullException(nameof(seasonsManager)); } this.wurmApi = wurmApi; this.logger = logger; this.soundManager = soundManager; this.trayPopups = trayPopups; this.seasonsManager = seasonsManager; useWurmTimeForDisplay = false; soundWarning = false; soundId = Guid.Empty; popupWarning = false; trackedSeasons = new string[0]; serverName = ""; mainWindowSize = new System.Drawing.Size(487, 414); updateTimer = timerFactory.CreateUiThreadTimer(); updateTimer.Interval = TimeSpan.FromMilliseconds(500); updateTimer.Tick += (sender, args) => { ObtainWdtForCurrentServer(); if (hasWdt) { UpdateOutputList(); } }; seasonsManager.DataChanged += SeasonsManagerOnDataChanged; }
public SmileXamineProcessor( [NotNull] GrangerFeature parentModule, [NotNull] GrangerContext context, [NotNull] PlayerManager playerMan, [NotNull] GrangerDebugLogger debugLogger, [NotNull] ITrayPopups trayPopups, [NotNull] ILogger logger, [NotNull] IWurmAssistantConfig wurmAssistantConfig, [NotNull] CreatureColorDefinitions creatureColorDefinitions, [NotNull] GrangerSettings grangerSettings) { if (parentModule == null) { throw new ArgumentNullException(nameof(parentModule)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (playerMan == null) { throw new ArgumentNullException(nameof(playerMan)); } if (debugLogger == null) { throw new ArgumentNullException(nameof(debugLogger)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (wurmAssistantConfig == null) { throw new ArgumentNullException(nameof(wurmAssistantConfig)); } if (creatureColorDefinitions == null) { throw new ArgumentNullException(nameof(creatureColorDefinitions)); } if (grangerSettings == null) { throw new ArgumentNullException(nameof(grangerSettings)); } this.debugLogger = debugLogger; this.trayPopups = trayPopups; this.logger = logger; this.wurmAssistantConfig = wurmAssistantConfig; this.creatureColorDefinitions = creatureColorDefinitions; this.parentModule = parentModule; this.context = context; this.playerMan = playerMan; this.grangerSettings = grangerSettings; }
public CustomTimer(string persistentObjectId, IWurmApi wurmApi, ILogger logger, ISoundManager soundManager, ITrayPopups trayPopups) : base(persistentObjectId, trayPopups, logger, wurmApi, soundManager) { if (logger == null) { throw new ArgumentNullException("logger"); } this.logger = logger; }
public SleepBonusNotify(ILogger logger, ISoundManager soundManager, ITrayPopups trayPopups, string popupTitle, string popupMessage, bool popupPersistent = false) { handler = new NotifyHandler(logger, soundManager, trayPopups) { PopupPersistent = popupPersistent, Message = (popupMessage ?? ""), Title = (popupTitle ?? "") }; }
public LogsFeedManager( [NotNull] GrangerFeature parentModule, [NotNull] GrangerContext context, [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] ITrayPopups trayPopups, [NotNull] IWurmAssistantConfig wurmAssistantConfig, [NotNull] CreatureColorDefinitions creatureColorDefinitions, [NotNull] GrangerSettings grangerSettings, [NotNull] ITelemetry telemetry) { if (parentModule == null) { throw new ArgumentNullException(nameof(parentModule)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (wurmApi == null) { throw new ArgumentNullException(nameof(wurmApi)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (wurmAssistantConfig == null) { throw new ArgumentNullException(nameof(wurmAssistantConfig)); } if (creatureColorDefinitions == null) { throw new ArgumentNullException(nameof(creatureColorDefinitions)); } if (grangerSettings == null) { throw new ArgumentNullException(nameof(grangerSettings)); } this.parentModule = parentModule; this.context = context; this.wurmApi = wurmApi; this.logger = logger; this.trayPopups = trayPopups; this.wurmAssistantConfig = wurmAssistantConfig; this.creatureColorDefinitions = creatureColorDefinitions; this.grangerSettings = grangerSettings; this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry)); }
public PopupNotifier([NotNull] ITrigger trigger, [NotNull] ITrayPopups trayPopups) { if (trigger == null) { throw new ArgumentNullException("trigger"); } if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } this.trigger = trigger; this.trayPopups = trayPopups; }
public RegexTrigger(TriggerEntity triggerEntity, ISoundManager soundManager, ITrayPopups trayPopups, IWurmApi wurmApi, ILogger logger, ITelemetry telemetry) : base(triggerEntity, soundManager, trayPopups, wurmApi, logger, telemetry) { if (logger == null) { throw new ArgumentNullException("logger"); } this.logger = logger; ConditionHelp = "C# regular expression pattern to match against log entry content."; SourceHelp = "C# regular expression pattern to match against log entry source. " + Environment.NewLine + "Source is the text between < >, for example game character than sent a PM. " + Environment.NewLine + "Leave empty to match everything."; }
public TriggerBase([NotNull] TriggerEntity triggerEntity, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] ITelemetry telemetry) { if (triggerEntity == null) { throw new ArgumentNullException("triggerEntity"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } if (wurmApi == null) { throw new ArgumentNullException("wurmApi"); } if (logger == null) { throw new ArgumentNullException("logger"); } this.TriggerEntity = triggerEntity; this.SoundManager = soundManager; this.TrayPopups = trayPopups; this.WurmApi = wurmApi; this.Logger = logger; this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry)); MuteChecker = () => false; Active = true; if (triggerEntity.HasSound) { Sound = new SoundNotifier(this, soundManager); } if (triggerEntity.HasPopup) { Popup = new PopupNotifier(this, trayPopups); } telemetry.TrackEvent($"Triggers: initialized trigger {this.GetType().Name}"); }
public FavorTimerNotify(PrayerTimer timer, string player, string serverGroupId, ILogger logger, ISoundManager soundManager, ITrayPopups trayPopups, [NotNull] SkillEntryParser skillEntryParser) { if (skillEntryParser == null) { throw new ArgumentNullException("skillEntryParser"); } this.serverGroupId = serverGroupId; this.skillEntryParser = skillEntryParser; Settings = timer.favorSettings; favorHandler = new NotifyHandler( logger, soundManager, trayPopups, Settings.FavorNotifySoundId, player, "", Settings.FavorNotifyPopupPersist); }
public TriggerBase([NotNull] TriggerEntity triggerEntity, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger) { if (triggerEntity == null) { throw new ArgumentNullException("triggerEntity"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } if (wurmApi == null) { throw new ArgumentNullException("wurmApi"); } if (logger == null) { throw new ArgumentNullException("logger"); } this.TriggerEntity = triggerEntity; this.SoundManager = soundManager; this.TrayPopups = trayPopups; this.WurmApi = wurmApi; this.Logger = logger; MuteChecker = () => false; Active = true; if (triggerEntity.HasSound) { Sound = new SoundNotifier(this, soundManager); } if (triggerEntity.HasPopup) { Popup = new PopupNotifier(this, trayPopups); } }
public AppMigrationsManager( [NotNull] IKernel kernel, [NotNull] IWurmAssistantDataDirectory dataDirectory, [NotNull] PersistentContextsManager persistentContextsManager, [NotNull] ILogger logger, [NotNull] ITrayPopups trayPopups, [NotNull] BackupManager backupManager) { if (kernel == null) { throw new ArgumentNullException(nameof(kernel)); } if (dataDirectory == null) { throw new ArgumentNullException(nameof(dataDirectory)); } if (persistentContextsManager == null) { throw new ArgumentNullException(nameof(persistentContextsManager)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (backupManager == null) { throw new ArgumentNullException(nameof(backupManager)); } this.kernel = kernel; this.persistentContextsManager = persistentContextsManager; this.logger = logger; this.trayPopups = trayPopups; this.backupManager = backupManager; upgradeInfoFile = new FileInfo(Path.Combine(dataDirectory.DirectoryPath, "upgrade.dat")); LoadCurrentVersion(); }
public SkillLevelTrigger(string characterName, TriggerEntity triggerEntity, ISoundManager soundManager, ITrayPopups trayPopups, IWurmApi wurmApi, ILogger logger) : base(triggerEntity, soundManager, trayPopups, wurmApi, logger) { if (characterName == null) { throw new ArgumentNullException("characterName"); } this.characterName = characterName; this.logger = logger; skillEntryParser = new SkillEntryParser(wurmApi); LockedLogTypes = new[] { LogType.Skills }; SkillFeedback = "(no data)"; skillHistoricRefresher = new TriggerableAsyncOperation(RefreshSkill); character = wurmApi.Characters.Get(characterName); character.LogInOrCurrentServerPotentiallyChanged += CharacterOnLogInOrCurrentServerPotentiallyChanged; skillHistoricRefresher.Trigger(); }
public EditTrigger( ITrigger trigger, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups) { if (soundManager == null) { throw new ArgumentNullException(nameof(soundManager)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } _trigger = trigger; this.soundManager = soundManager; this.trayPopups = trayPopups; InitializeComponent(); Text = trigger.TypeAspect.Capitalize() + " Trigger"; trigger.Configs.ToList() .ForEach(x => SettingsLayout.Controls.Add(x.ControlHandle)); trigger.GetNotifiers().ToList() .ForEach(AddConfigurator); }
public PlayerTimersGroup(string persistentObjectId, TimersFeature timersFeature, [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, [NotNull] TimerDefinitions timerDefinitions, [NotNull] TimerInstances timerInstances) : base(persistentObjectId) { if (wurmApi == null) { throw new ArgumentNullException("wurmApi"); } if (logger == null) { throw new ArgumentNullException("logger"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } if (timerDefinitions == null) { throw new ArgumentNullException("timerDefinitions"); } if (timerInstances == null) { throw new ArgumentNullException("timerInstances"); } this.Id = Guid.Parse(persistentObjectId); this.timersFeature = timersFeature; this.wurmApi = wurmApi; this.logger = logger; this.timerDefinitions = timerDefinitions; this.timerInstances = timerInstances; }
public NotifyHandler([NotNull] ILogger logger, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, Guid?soundId = null, string messageTitle = "", string messageContent = "", bool messagePersist = false) { if (logger == null) { throw new ArgumentNullException("logger"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } this.logger = logger; this.soundManager = soundManager; this.trayPopups = trayPopups; this.SoundId = soundId ?? Guid.Empty; this.Title = messageTitle; this.Message = messageContent; this.PopupPersistent = messagePersist; }
public JunkSaleTimer(string persistentObjectId, IWurmApi wurmApi, ILogger logger, ISoundManager soundManager, ITrayPopups trayPopups, ITelemetry telemetry) : base(persistentObjectId, trayPopups, logger, wurmApi, soundManager, telemetry) { }
public PrayerTimer(string persistentObjectId, IWurmApi wurmApi, ILogger logger, ISoundManager soundManager, ITrayPopups trayPopups, ITelemetry telemetry) : base(persistentObjectId, trayPopups, logger, wurmApi, soundManager, telemetry) { updatePrayerCooldownOperation = new TriggerableAsyncOperation(UpdatePrayerCooldown); }
public ChooseNotifierType(ITrigger trigger, IEnumerable <INotifier> existingNotifiers, [NotNull] ITrayPopups trayPopups, [NotNull] ISoundManager soundManager) { if (trayPopups == null) { throw new ArgumentNullException("trayPopups"); } if (soundManager == null) { throw new ArgumentNullException("soundManager"); } InitializeComponent(); var enumerable = existingNotifiers as INotifier[] ?? existingNotifiers.ToArray(); CreateButton("Sound Notifier", () => Result = new SoundNotifier(trigger, soundManager), enumerable.Any(x => x is ISoundNotifier)); CreateButton("Popup Notifier", () => Result = new PopupNotifier(trigger, trayPopups), enumerable.Any(x => x is IPopupNotifier)); }
public AlignmentTimer(string persistentObjectId, IWurmApi wurmApi, ILogger logger, ISoundManager soundManager, ITrayPopups trayPopups) : base(persistentObjectId, trayPopups, logger, wurmApi, soundManager) { }
protected SimpleConditionTriggerBase(TriggerEntity triggerEntity, ISoundManager soundManager, ITrayPopups trayPopups, IWurmApi wurmApi, ILogger logger, ITelemetry telemetry) : base(triggerEntity, soundManager, trayPopups, wurmApi, logger, telemetry) { }
public PlayerManager( [NotNull] GrangerFeature parentModule, [NotNull] GrangerContext context, [NotNull] string playerName, [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] ITrayPopups trayPopups, [NotNull] IWurmAssistantConfig wurmAssistantConfig, [NotNull] CreatureColorDefinitions creatureColorDefinitions, [NotNull] GrangerSettings grangerSettings, [NotNull] ITelemetry telemetry) { if (parentModule == null) { throw new ArgumentNullException(nameof(parentModule)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (playerName == null) { throw new ArgumentNullException(nameof(playerName)); } if (wurmApi == null) { throw new ArgumentNullException(nameof(wurmApi)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (wurmAssistantConfig == null) { throw new ArgumentNullException(nameof(wurmAssistantConfig)); } if (creatureColorDefinitions == null) { throw new ArgumentNullException(nameof(creatureColorDefinitions)); } if (grangerSettings == null) { throw new ArgumentNullException(nameof(grangerSettings)); } if (telemetry == null) { throw new ArgumentNullException(nameof(telemetry)); } this.parentModule = parentModule; this.wurmApi = wurmApi; this.logger = logger; this.PlayerName = playerName; creatureUpdateManager = new CreatureUpdatesManager(this.parentModule, context, this, trayPopups, logger, wurmAssistantConfig, creatureColorDefinitions, grangerSettings, telemetry); wurmApi.LogsMonitor.Subscribe(PlayerName, LogType.Event, OnNewEventLogEvents); character = wurmApi.Characters.Get(PlayerName); character.LogInOrCurrentServerPotentiallyChanged += CharacterOnLogInOrCurrentServerPotentiallyChanged; character.Skills.SkillsChanged += SkillsOnSkillsChanged; BeginUpdateSkillInfo(); }
public SimpleTrigger(TriggerEntity triggerEntity, ISoundManager soundManager, ITrayPopups trayPopups, IWurmApi wurmApi, ILogger logger) : base(triggerEntity, soundManager, trayPopups, wurmApi, logger) { ConditionHelp = "Text to match against log entry content, case insensitive"; SourceHelp = "Test to match against log entry source. " + Environment.NewLine + "Source is the text between < >, for example game character than sent a PM. " + Environment.NewLine + "Case insensitive. " + Environment.NewLine + "Leave empty to match everything."; }
public MeditationTimer(string persistentObjectId, IWurmApi wurmApi, ILogger logger, ISoundManager soundManager, ITrayPopups trayPopups) : base(persistentObjectId, trayPopups, logger, wurmApi, soundManager) { cooldownUpdateOperation = new TriggerableAsyncOperation(UpdateMeditationCooldown); }
public TriggersFeature( [NotNull] ISoundManager soundManager, [NotNull] IWurmAssistantDataDirectory wurmAssistantDataDirectory, [NotNull] ITimerFactory timerFactory, [NotNull] IWurmApi wurmApi, [NotNull] ITrayPopups trayPopups, [NotNull] ILogger logger, [NotNull] TriggersDataContext triggersDataContext, [NotNull] ITriggerManagerFactory triggerManagerFactory) { if (soundManager == null) { throw new ArgumentNullException(nameof(soundManager)); } if (wurmAssistantDataDirectory == null) { throw new ArgumentNullException(nameof(wurmAssistantDataDirectory)); } if (timerFactory == null) { throw new ArgumentNullException(nameof(timerFactory)); } if (wurmApi == null) { throw new ArgumentNullException(nameof(wurmApi)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (triggersDataContext == null) { throw new ArgumentNullException(nameof(triggersDataContext)); } if (triggerManagerFactory == null) { throw new ArgumentNullException(nameof(triggerManagerFactory)); } this.soundManager = soundManager; this.wurmAssistantDataDirectory = wurmAssistantDataDirectory; this.wurmApi = wurmApi; this.trayPopups = trayPopups; this.logger = logger; this.triggersDataContext = triggersDataContext; this.triggerManagerFactory = triggerManagerFactory; updateTimer = timerFactory.CreateUiThreadTimer(); updateTimer.Interval = TimeSpan.FromMilliseconds(500); updateTimer.Tick += (sender, args) => Update(); mainUi = new FormTriggersMain(this, soundManager); foreach (var name in GetAllActiveCharacters()) { AddManager(name); } updateTimer.Start(); }
public TriggerManager( [NotNull] string characterName, [NotNull] IWurmApi wurmApi, [NotNull] ISoundManager soundManager, [NotNull] ILogger logger, [NotNull] ITrayPopups trayPopups, [NotNull] IActiveTriggersFactory activeTriggersFactory, [NotNull] IWindowManager windowManager, [NotNull] TriggersDataContext triggersDataContext, [NotNull] IExporterFactory exporterFactory, [NotNull] IImporterFactory importerFactory) { if (characterName == null) { throw new ArgumentNullException(nameof(characterName)); } if (wurmApi == null) { throw new ArgumentNullException(nameof(wurmApi)); } if (soundManager == null) { throw new ArgumentNullException(nameof(soundManager)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (activeTriggersFactory == null) { throw new ArgumentNullException(nameof(activeTriggersFactory)); } if (windowManager == null) { throw new ArgumentNullException(nameof(windowManager)); } if (triggersDataContext == null) { throw new ArgumentNullException(nameof(triggersDataContext)); } if (exporterFactory == null) { throw new ArgumentNullException(nameof(exporterFactory)); } if (importerFactory == null) { throw new ArgumentNullException(nameof(importerFactory)); } this.CharacterName = characterName; this.wurmApi = wurmApi; this.soundManager = soundManager; this.logger = logger; this.trayPopups = trayPopups; this.activeTriggersFactory = activeTriggersFactory; this.windowManager = windowManager; this.exporterFactory = exporterFactory; this.importerFactory = importerFactory; this.triggersConfig = triggersDataContext.CharacterTriggersConfigs.GetOrCreate(characterName); activeTriggers = activeTriggersFactory.CreateActiveTriggers(CharacterName); activeTriggers.MutedEvaluator = GetMutedEvaluator(); //create control for Module UI controlUi = new UcPlayerTriggersController(); //create this notifier UI triggersConfigUi = new FormTriggersConfig(this, soundManager, windowManager, exporterFactory, importerFactory); UpdateMutedState(); controlUi.label1.Text = CharacterName; controlUi.buttonMute.Click += ToggleMute; controlUi.buttonConfigure.Click += Configure; controlUi.buttonRemove.Click += StopAndRemove; try { wurmApi.LogsMonitor.Subscribe(this.CharacterName, LogType.AllLogs, OnNewLogEvents); } catch (DataNotFoundException exception) { logger.Warn(exception, $"Unable to subscribe LogsMonitor events for character {this.CharacterName}."); } }
public GrangerFeature( [NotNull] ILogger logger, [NotNull] IWurmAssistantDataDirectory dataDirectory, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups, [NotNull] IWurmApi wurmApi, [NotNull] GrangerSettings grangerSettings, [NotNull] DefaultBreedingEvaluatorOptions defaultBreedingEvaluatorOptions, [NotNull] IWurmAssistantConfig wurmAssistantConfig, [NotNull] ITimerFactory timerFactory, [NotNull] CreatureColorDefinitions creatureColorDefinitions, [NotNull] GrangerContext grangerContext, [NotNull] IFormEditCreatureColorsFactory formEditCreatureColorsFactory, [NotNull] ITelemetry telemetry) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (dataDirectory == null) { throw new ArgumentNullException(nameof(dataDirectory)); } if (soundManager == null) { throw new ArgumentNullException(nameof(soundManager)); } if (trayPopups == null) { throw new ArgumentNullException(nameof(trayPopups)); } if (wurmApi == null) { throw new ArgumentNullException(nameof(wurmApi)); } if (grangerSettings == null) { throw new ArgumentNullException(nameof(grangerSettings)); } if (defaultBreedingEvaluatorOptions == null) { throw new ArgumentNullException(nameof(defaultBreedingEvaluatorOptions)); } if (wurmAssistantConfig == null) { throw new ArgumentNullException(nameof(wurmAssistantConfig)); } if (timerFactory == null) { throw new ArgumentNullException(nameof(timerFactory)); } if (creatureColorDefinitions == null) { throw new ArgumentNullException(nameof(creatureColorDefinitions)); } if (grangerContext == null) { throw new ArgumentNullException(nameof(grangerContext)); } if (formEditCreatureColorsFactory == null) { throw new ArgumentNullException(nameof(formEditCreatureColorsFactory)); } this.logger = logger; this.dataDirectory = dataDirectory; this.soundManager = soundManager; this.trayPopups = trayPopups; settings = grangerSettings; this.defaultBreedingEvaluatorOptions = defaultBreedingEvaluatorOptions; this.creatureColorDefinitions = creatureColorDefinitions; context = grangerContext; this.formEditCreatureColorsFactory = formEditCreatureColorsFactory; this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry)); grangerUi = new FormGrangerMain(this, settings, context, logger, wurmApi, defaultBreedingEvaluatorOptions, creatureColorDefinitions, formEditCreatureColorsFactory, telemetry); logsFeedMan = new LogsFeedManager(this, context, wurmApi, logger, trayPopups, wurmAssistantConfig, creatureColorDefinitions, grangerSettings, telemetry); logsFeedMan.UpdatePlayers(settings.CaptureForPlayers); grangerUi.GrangerPlayerListChanged += GrangerUI_Granger_PlayerListChanged; updateLoop = timerFactory.CreateUiThreadTimer(); updateLoop.Interval = TimeSpan.FromMilliseconds(500); updateLoop.Tick += (sender, args) => Update(); updateLoop.Start(); }
public ActionQueueTrigger(TriggerEntity triggerEntity, ISoundManager soundManager, ITrayPopups trayPopups, IWurmApi wurmApi, ILogger logger, [NotNull] IActionQueueConditions conditionsManager, ITelemetry telemetry) : base(triggerEntity, soundManager, trayPopups, wurmApi, logger, telemetry) { if (logger == null) { throw new ArgumentNullException("logger"); } if (conditionsManager == null) { throw new ArgumentNullException("conditionsManager"); } this.logger = logger; this.conditionsManager = conditionsManager; LockedLogTypes = new[] { LogType.Event }; lastActionFinished = DateTime.Now; lastActionStarted = DateTime.Now; lastEventLine = string.Empty; }