Exemple #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);
        }
 static bool Parse(string item, out TestTag tag)
 {
     tag = default(TestTag);
     if (string.IsNullOrEmpty(item))
     {
         throw SpecFailure.EmptyString(nameof(item));
     }
     return(TestTag.TryParse(item, out tag));
 }
 public string GetFullPath(string fileName)
 {
     if (fileName == null)
     {
         throw new ArgumentNullException("fileName");
     }
     if (string.IsNullOrEmpty(fileName))
     {
         throw SpecFailure.EmptyString("fileName");
     }
     return(CheckFileName(fileName));
 }
        public static StreamContext FromFile(string fileName)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }
            if (string.IsNullOrEmpty(fileName))
            {
                throw SpecFailure.EmptyString("fileName");
            }
            var uri = new Uri(fileName, UriKind.RelativeOrAbsolute);

            if (Path.IsPathRooted(fileName))
            {
                uri = new Uri("file://" + fileName);
            }
            return(new FileSystemStreamContext(uri));
        }