Пример #1
0
        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;
        }
Пример #2
0
        public DefaultSoundEngine([NotNull] ITimerFactory timerFactory)
        {
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }

            var timer = timerFactory.CreateUiThreadTimer();

            timer.Interval = TimeSpan.FromSeconds(50);
            timer.Tick    += (sender, args) => CleanupWeakRefs();
            timer.Start();
        }
        public PersistentContextsManager([NotNull] IWurmAssistantDataDirectory wurmAssistantDataDirectory,
                                         [NotNull] ITimerFactory timerFactory)
        {
            if (wurmAssistantDataDirectory == null)
            {
                throw new ArgumentNullException(nameof(wurmAssistantDataDirectory));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            this.wurmAssistantDataDirectory = wurmAssistantDataDirectory;

            timer          = timerFactory.CreateUiThreadTimer();
            timer.Interval = TimeSpan.FromSeconds(15);
            timer.Tick    += TimerOnTick;
            timer.Start();
        }
Пример #4
0
        public PersistenceEnabler([NotNull] PersistenceManager persistenceManager, [NotNull] ITimerFactory timerFactory,
                                  [NotNull] IKernelConfig kernelConfig)
        {
            if (persistenceManager == null)
            {
                throw new ArgumentNullException(nameof(persistenceManager));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (kernelConfig == null)
            {
                throw new ArgumentNullException(nameof(kernelConfig));
            }
            this.updateTimer          = timerFactory.CreateUiThreadTimer();
            this.updateTimer.Interval = TimeSpan.FromMilliseconds(500);
            this.updateTimer.Tick    += UpdateLoopOnUpdated;

            this.persistenceManager = persistenceManager;
            this.kernelConfig       = kernelConfig;

            this.updateTimer.Start();
        }
Пример #5
0
        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();
        }
Пример #6
0
        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();
        }
Пример #7
0
        public TimersFeature(
            [NotNull] ITimerFactory timerFactory,
            [NotNull] ILogger logger,
            [NotNull] IWurmApi wurmApi,
            [NotNull] ISoundManager soundManager,
            [NotNull] ITrayPopups trayPopups,
            [NotNull] TimerDefinitions timerDefinitions,
            [NotNull] IPersistentObjectResolver <PlayerTimersGroup> playerTimersGroupsResolver,
            [NotNull] TimerInstances timerInstances)
        {
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException(nameof(wurmApi));
            }
            if (soundManager == null)
            {
                throw new ArgumentNullException(nameof(soundManager));
            }
            if (trayPopups == null)
            {
                throw new ArgumentNullException(nameof(trayPopups));
            }
            if (timerDefinitions == null)
            {
                throw new ArgumentNullException(nameof(timerDefinitions));
            }
            if (playerTimersGroupsResolver == null)
            {
                throw new ArgumentNullException(nameof(playerTimersGroupsResolver));
            }
            if (timerInstances == null)
            {
                throw new ArgumentNullException(nameof(timerInstances));
            }
            this.logger                     = logger;
            this.wurmApi                    = wurmApi;
            this.soundManager               = soundManager;
            this.trayPopups                 = trayPopups;
            this.timerDefinitions           = timerDefinitions;
            this.playerTimersGroupsResolver = playerTimersGroupsResolver;
            this.timerInstances             = timerInstances;

            updateTimer = timerFactory.CreateUiThreadTimer();

            updateTimer.Interval = TimeSpan.FromMilliseconds(500);
            updateTimer.Tick    += (sender, args) =>
            {
                foreach (var timergroup in timerGroups)
                {
                    timergroup.Update();
                }
                ;
            };
        }