Esempio n. 1
0
        /// <returns>True if item was added. False if it already existed in the range.</returns>
        override public bool TryAdd(Dictionary <string, string> row, string fileName)
        {
            Helper.CheckCondition(row.ContainsKey("rowIndex"), string.Format(@"When auditing tabulation a ""rowIndex"" column is required. (File ""{0}"")", fileName));
            Helper.CheckCondition(row.ContainsKey("rowCount"), string.Format(@"When auditing tabulation a ""rowCount"" column is required. (File ""{0}"")", fileName));

            RangeCollection rowIndexRange = RangeCollection.Parse(row["rowIndex"]);
            long            rowCount      = long.Parse(row["rowCount"]);

            Helper.CheckCondition(rowIndexRange.IsBetween(0, rowCount - 1), string.Format(@"rowIndex must be at least zero and less than rowCount (File ""{0}"")", fileName));
            if (RowCountSoFar == long.MinValue)
            {
                RowCountSoFar = rowCount;
            }
            else
            {
                Helper.CheckCondition(RowCountSoFar == rowCount, string.Format("A different row count was at rowIndex {0} in file {1}", rowIndexRange, fileName));
            }

            bool tryAdd = RowIndexRangeCollection.TryAddRangeCollection(rowIndexRange);

            return(tryAdd);
        }