Ejemplo n.º 1
0
        ///<summary>Writes Zmanim for a range of years from a ZmanimProvider to this instance's directory.</summary>
        ///<param name="provider">The ZmanimProvider to read Zmanim from.</param>
        ///<param name="fromYear">The first year to write.</param>
        ///<param name="toYear">The last year to write.</param>
        ///<param name="writeDateColumn">Whether to write a column with the date of each row (to make the output more readable).</param>
        public void Write(ZmanimProvider provider, int fromYear, int toYear, bool writeDateColumn)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider", "provider is null.");
            }
            if (fromYear > toYear)
            {
                var t = fromYear; fromYear = toYear; toYear = t;
            }
            for (int year = fromYear; year <= toYear; year++)
            {
                var zmanim = provider.GetZmanim(new DateTime(year, 1, 1), new DateTime(year, 12, 31)).ToArray();

                if (zmanim.Any(z => z == null))
                {
                    throw new ArgumentException(provider.ToString() + " cannot provide zmanim for " + year, "provider");
                }
                WriteYear(zmanim, writeDateColumn);
            }
        }
Ejemplo n.º 2
0
        ///<summary>Writes Zmanim for a range of years from a ZmanimProvider to this instance's directory.</summary>
        ///<param name="provider">The ZmanimProvider to read Zmanim from.</param>
        ///<param name="fromYear">The first year to write.</param>
        ///<param name="toYear">The last year to write.</param>
        ///<param name="writeDateColumn">Whether to write a column with the date of each row (to make the output more readable).</param>
        public void Write(ZmanimProvider provider, int fromYear, int toYear, bool writeDateColumn)
        {
            if (provider == null) throw new ArgumentNullException("provider", "provider is null.");
            if (fromYear > toYear) { var t = fromYear; fromYear = toYear; toYear = t; }
            for (int year = fromYear; year <= toYear; year++) {
                var zmanim = provider.GetZmanim(new DateTime(year, 1, 1), new DateTime(year, 12, 31)).ToArray();

                if (zmanim.Any(z => z == null)) throw new ArgumentException(provider.ToString() + " cannot provide zmanim for " + year, "provider");
                WriteYear(zmanim, writeDateColumn);
            }
        }