// test if today is tithi of given masa, or day after tithi of given masa // while in second cas yesterday is tithi before given tithi and masa public bool testFestival(GCFestivalSpecialExecutor exec, bool stickToMasa) { VAISNAVADAY yesterday = exec.day(-DayOffset - 1); VAISNAVADAY today = exec.day(-DayOffset); VAISNAVADAY tomorrow = exec.day(-DayOffset + 1); if (today.astrodata.Masa == nMasa && today.astrodata.sunRise.Tithi == nTithi) { if (yesterday.astrodata.Masa == nMasa && yesterday.astrodata.sunRise.Tithi == nTithi) { return(false); } else { return(true); } } if (stickToMasa || GCMasa.IS_EXTRA(today.astrodata.Masa)) { if (today.ksayaMasa == nMasa && today.ksayaTithi == nTithi) { return(true); } } else { if (yesterday.ksayaMasa == nMasa && yesterday.ksayaTithi == nTithi) { return(true); } } return(false); }
// test if today is tithi of given masa, or day after tithi of given masa // while in second cas yesterday is tithi before given tithi and masa public bool testFestival(GCFestivalSpecialExecutor exec, bool stickToMasa) { VAISNAVADAY yesterday = exec.day(-DayOffset - 1); VAISNAVADAY today = exec.day(-DayOffset); VAISNAVADAY tomorrow = exec.day(-DayOffset + 1); if (today.astrodata.Masa == nMasa && today.astrodata.sunRise.Tithi == nTithi) { if (yesterday.astrodata.Masa == nMasa && yesterday.astrodata.sunRise.Tithi == nTithi) { return(false); } else { return(true); } } // in case tithi is ksaya, and we want to observe festival on the calendar day, when tithi is ksaya, return yes if (today.ksayaMasa == nMasa && today.ksayaTithi == nTithi && GCDisplaySettings.Current.AdvFestivalFirstDay) { return(true); } if (stickToMasa || GCMasa.IS_EXTRA(today.astrodata.Masa)) { if (today.ksayaMasa == nMasa && today.ksayaTithi == nTithi) { return(true); } } else { if (yesterday.ksayaMasa == nMasa && yesterday.ksayaTithi == nTithi && GCDisplaySettings.Current.AdvFestivalFirstDay == false) { return(true); } } return(false); }