private void ParsePaths(IEnumerable<string> paths)
{
if (paths == null || paths.Count() == 0)
{
throw new EventSourcingException("Path count can not be null or zero.");
}
if (paths.Count() == 1)
{
var path = paths.Single();
if (string.IsNullOrEmpty(path))
{
throw new EventSourcingException("Path can not be null or empty string.");
}
var items = path.Split(new string[] { Seperator }, StringSplitOptions.RemoveEmptyEntries);
if (items.Length == 1)
{
_paths.Add(new Path(null, path));
}
else if (items.Length == 2)
{
AddNewPath(path, items[0], items[1]);
}
else
{
throw new EventSourcingException(string.Format("Invalid path format, path:{0}", path));
}
}
else
{
foreach (var path in paths)
{
if (string.IsNullOrEmpty(path))
{
throw new EventSourcingException("Path can not be null or empty string.");
}
var items = path.Split(new string[] { Seperator }, StringSplitOptions.RemoveEmptyEntries);
if (items.Length != 2)
{
throw new EventSourcingException(string.Format("Invalid path format, path:{0}", path));
}
else
{
AddNewPath(path, items[0], items[1]);
}
}
}
}