<commit_before>using System;
using ValveResourceFormat.Serialization;

namespace GUI.Types.ParticleRenderer.Emitters
{
    public class ContinuousEmitter : IParticleEmitter
    {
        public bool IsFinished { get; private set; }

        private readonly IKeyValueCollection baseProperties;

        private Action<Particle> particleEmitCallback;

        private long particleCount;
        private float time;

        public ContinuousEmitter(IKeyValueCollection baseProperties, IKeyValueCollection keyValues)
        {
            this.baseProperties = baseProperties;
        }

        public void Start(Action<Particle> particleEmitCallback)
        {
            this.particleEmitCallback = particleEmitCallback;

            particleCount = 0;
            time = 0f;

            IsFinished = false;
        }

        public void Stop()
        {
            IsFinished = true;
        }

        public void Update(float frameTime)
        {
            if (IsFinished)
            {
                return;
            }

            time += frameTime;

            var particle = new Particle(baseProperties);
            particle.ParticleCount = ++particleCount;
            particleEmitCallback(particle);
        }
    }
}<commit_msg>Added continuousEmitter<commit_after>using System;
using ValveResourceFormat.Serialization;

namespace GUI.Types.ParticleRenderer.Emitters
{
    public class ContinuousEmitter : IParticleEmitter
    {
        public bool IsFinished { get; private set; }

        private readonly IKeyValueCollection baseProperties;

        private readonly float emissionDuration = 0f;
        private readonly float startTime = 0f;
        private readonly float emitRate = 100f;
        private readonly float emitInterval = 0.01f;

        private Action<Particle> particleEmitCallback;

        private long particleCount;
        private float time;
        private float lastEmissionTime;

        public ContinuousEmitter(IKeyValueCollection baseProperties, IKeyValueCollection keyValues)
        {
            this.baseProperties = baseProperties;

            if (keyValues.ContainsKey("m_flEmissionDuration"))
            {
                emissionDuration = keyValues.GetFloatProperty("m_flEmissionDuration");
            }

            if (keyValues.ContainsKey("m_flStartTime"))
            {
                startTime = keyValues.GetFloatProperty("m_flStartTime");
            }

            if (keyValues.ContainsKey("m_flEmitRate"))
            {
                emitRate = keyValues.GetFloatProperty("m_flEmitRate");
                emitInterval = 1 / emitRate;
            }
        }

        public void Start(Action<Particle> particleEmitCallback)
        {
            this.particleEmitCallback = particleEmitCallback;

            particleCount = 0;
            time = 0f;
            lastEmissionTime = 0;

            IsFinished = false;
        }

        public void Stop()
        {
            IsFinished = true;
        }

        public void Update(float frameTime)
        {
            if (IsFinished)
            {
                return;
            }

            time += frameTime;

            if (time >= startTime && (emissionDuration == 0f || time <= startTime + emissionDuration))
            {
                var numToEmit = Math.Floor((time - lastEmissionTime) / emitInterval);
                for (var i = 0; i < numToEmit; i++)
                {
                    var particle = new Particle(baseProperties);
                    particle.ParticleCount = ++particleCount;
                    lastEmissionTime += emitInterval;
                    particleEmitCallback(particle);
                }
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.06894694317263668, 'fraction_numerical': 0.0043091839482897925, 'mean_word_length': 1.7613382899628254, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7656589', 'n_tokens_mistral': 929, 'n_tokens_neox': 884, 'n_words': 201}