Exemplo n.º 1
0
        public void StopExtractor(bool notify = true)
        {
            IsActive = false;

            if (notify)
            {
                OnExtractorNotification?.Invoke($"{Name} extractor resource harvesting cancelled.");
            }
        }
Exemplo n.º 2
0
        public void StartExtractor(bool notify = true)
        {
            ticker.ResetToTimeOffset(ProcessingTime);
            IsActive = true;

            if (notify)
            {
                OnExtractorNotification?.Invoke($"{Name} extractors started, they will complete their resource harvesting in {Utilities.ReadableTimeSpan(ProcessingTime, false)}.");
            }
        }
Exemplo n.º 3
0
        protected void OnTickerState(TickerState oldState, TickerState newState)
        {
            switch (newState)
            {
            case TickerState.Disabling:
                OnExtractorNotification?.Invoke($"{Name} extractors will complete their resource harvesting soon.");
                break;

            case TickerState.Disabled:
                OnExtractorNotification?.Invoke($"{Name} extractors have completed their resource harvesting.");
                IsActive = false;
                OnExtractorFinished?.Invoke();
                break;
            }
        }
Exemplo n.º 4
0
        public void ResumeExtractor(long ticks, bool notify = true)
        {
            var timeExpiry = new DateTime(ticks);

            ticker.ResetToTimeSpecific(timeExpiry);
            IsActive = timeExpiry > DateTime.UtcNow;

            if (!notify)
            {
                return;
            }

            if (IsActive)
            {
                OnExtractorNotification?.Invoke($"{Name} extractors resumed, they will complete their resource harvesting in {Utilities.ReadableTimeSpan(timeExpiry.Subtract(DateTime.UtcNow), false)}.");
            }
            else
            {
                OnExtractorNotification?.Invoke($"{Name} extractors completed their resource harvesting {Utilities.ReadableTimeSpan(DateTime.UtcNow.Subtract(timeExpiry), false)} ago.");
            }
        }