Dev2.PathOperations.Dev2ActivityIOBroker.MakeDirectoryParts C# (CSharp) Method

MakeDirectoryParts() private method

private MakeDirectoryParts ( IActivityIOPath path, string splitter ) : IList
path IActivityIOPath
splitter string
return IList
        IList<string> MakeDirectoryParts(IActivityIOPath path, string splitter)
        {
            string[] tmp;

            IList<string> result = new List<string>();

            var splitOn = splitter.ToCharArray();

            if(IsNotFtpTypePath(path))
            {
                tmp = path.Path.Split(splitOn);

            }
            else
            {
                var splitValues = path.Path.Split(new[] { "://" }, StringSplitOptions.RemoveEmptyEntries).ToList();
                splitValues.RemoveAt(0);
                var newPath = string.Join("/", splitValues);
                tmp = newPath.Split(splitOn);
            }

            // remove trailing file entry if exist
            var candiate = tmp[tmp.Length - 1];
            var len = tmp.Length;
            if(candiate.Contains("*.") || candiate.Contains("."))
            {
                len = tmp.Length - 1;
            }

            var builderPath = "";
            // build up URI parts from root down
            for(var i = 0; i < len; i++)
            {
                if(!string.IsNullOrWhiteSpace(tmp[i]))
                {
                    builderPath += tmp[i] + splitter;
                    if(!IsNotFtpTypePath(path) && !builderPath.Contains("://"))
                    {
                        var splitValues = path.Path.Split(new[] { "://" }, StringSplitOptions.RemoveEmptyEntries).ToList();
                        builderPath = splitValues[0] + "://" + builderPath;
                    }
                    result.Add(IsUncFileTypePath(path) ? @"\\" + builderPath : builderPath);
                }
            }
            return result;
        }