private int[] ParseDefaultTopAndGrowth(string value)
{
var items = value.Split(',');
var values = new int[items.Length];
for (int i = 0; i < items.Length; i++)
{
var last = i == items.Length - 1;
var parsedInt = 0;
if (Int32.TryParse(items[i], out parsedInt))
values[i] = parsedInt;
else
throw new SenseNet.ContentRepository.Storage.Data.ConfigurationException("Invalid sequence in the value of 'DefaultTopAndGrowth'. Every value can be positive integer except last, it can be positive integer or zero.");
if (parsedInt < 0)
throw new SenseNet.ContentRepository.Storage.Data.ConfigurationException("Invalid sequence in the value of 'DefaultTopAndGrowth'. A value cannot less than 0.");
if (parsedInt == 0)
{
if(!last)
throw new SenseNet.ContentRepository.Storage.Data.ConfigurationException("Invalid sequence in the value of 'DefaultTopAndGrowth'. Only the last value can be 0.");
}
else
{
if (i > 0 && parsedInt <= values[i - 1])
throw new SenseNet.ContentRepository.Storage.Data.ConfigurationException("Invalid sequence in the value of 'DefaultTopAndGrowth'. The sequence must be monotonically increasing. Last value can be greater than any other or zero.");
}
}
return values;
}
}