Пример #1
0
        static Exception _TryParse(string text, out SegmentSequence[] results2)
        {
            results2 = null;
            if (text == null)
            {
                return(new ArgumentNullException("text"));
            }
            if (text.Length == 0)
            {
                return(SpecFailure.EmptyString("text"));
            }

            List <SegmentSequence> results = new List <SegmentSequence>();

            foreach (string sub in text.Split(';'))
            {
                if (Path.IsPathRooted(sub) && NoSpecialChars(sub))
                {
                    RootedSegmentSequence sequence = new RootedSegmentSequence(sub);
                    results.Add(sequence);
                }
                else
                {
                    IteratedSegmentSequence segments;
                    _TryParseList(sub, out segments);
                    results.Add(segments);
                }
            }

            results2 = results.ToArray();
            return(null);
        }
Пример #2
0
        static Exception _TryParse(string text, out SegmentSequence[] results2) {
            results2 = null;
            if (string.IsNullOrEmpty(text)) {
                return Failure.NullOrEmptyString(nameof(text));
            }

            List<SegmentSequence> results = new List<SegmentSequence>();

            foreach (string sub in text.Split(';')) {

                if (Path.IsPathRooted(sub) && NoSpecialChars(sub)) {
                    RootedSegmentSequence sequence = new RootedSegmentSequence(sub);
                    results.Add(sequence);

                } else {
                    IteratedSegmentSequence segments;
                    _TryParseList(sub, out segments);
                    results.Add(segments);
                }
            }

            results2 = results.ToArray();
            return null;
        }
        static Exception _TryParse(string text, out SegmentSequence[] results2)
        {
            results2 = null;
            if (text == null)
                return new ArgumentNullException("text");
            if (text.Length == 0)
                return Failure.EmptyString("text");

            List<SegmentSequence> results = new List<SegmentSequence>();

            foreach (string sub in text.Split(';')) {

                if (Path.IsPathRooted(sub) && NoSpecialChars(sub)) {
                    RootedSegmentSequence sequence = new RootedSegmentSequence(sub);
                    results.Add(sequence);

                } else {
                    IteratedSegmentSequence segments;
                    _TryParseList(sub, out segments);
                    results.Add(segments);
                }
            }

            results2 = results.ToArray();
            return null;
        }