DRObjects.DataStructures.DivineRightDateTime.Add C# (CSharp) Method

Add() public method

Adds a time component to the total
public Add ( DRTimeComponent component, int value ) : void
component DRTimeComponent
value int
return void
        public void Add(DRTimeComponent component, int value)
        {
            if (component == DRTimeComponent.MONTH || component == DRTimeComponent.DAY)
            {
                value--;
            }

            //Store Minute, Month and Year
            int minute = this.GetTimeComponent(DRTimeComponent.MINUTE);
            int month = this.GetTimeComponent(DRTimeComponent.MONTH);
            int day = this.GetTimeComponent(DRTimeComponent.DAY);

            time += MULTIPLIERS[(int)component] * value;

            if (minute != this.GetTimeComponent(DRTimeComponent.MINUTE))
            {
                if (MinuteChanged != null)
                {
                    //Fire the event
                    MinuteChanged(this, null);
                }
            }

            if (month != this.GetTimeComponent(DRTimeComponent.MONTH))
            {
                if (MonthChanged != null)
                {
                    MonthChanged(this, null);
                }
            }

            if (day != this.GetTimeComponent(DRTimeComponent.DAY))
            {
                if (DayChanged != null)
                {
                    //Fire the event
                    DayChanged(this, null);
                }
            }
        }