using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PXP.Crawler.API.Model;

namespace PXP.Crawler.API.Plugins.Events
{
    [NodeInfo("Change (String)", typeof(ChangeStringNode), Category = "Events", Description = "Detect string change...",
        DefaultWidth = 70, DefaultHeight = 40, LockHeight = true)]
    public class ChangeStringNode : ChangeNodeBase<string>
    {
        public ChangeStringNode(Program program) : base(program)
        {
            Name = "Change";
            currValue = "";
        }

        public override bool CompareValueChanged(string val)
        {
            if (val == null)
            {
                if (currValue == null)
                {
                    return true;
                }
                return false;
            }
            if (currValue.Length != val.Length)
                return true;
            return currValue != val;
        }
    }
}
