public void CanParseName()
        {
            if (!VarPackageName.TryGet("Author.Package.1.var", out var name))
            {
                Assert.Fail("Could not parse");
            }

            Assert.That(name.Author, Is.EqualTo("Author"));
            Assert.That(name.Name, Is.EqualTo("Package"));
            Assert.That(name.Version, Is.EqualTo(1));
        }
        public void CanParseWildcards()
        {
            if (!VarPackageName.TryGet("*.*.*.var", out var name))
            {
                Assert.Fail("Could not parse");
            }

            Assert.That(name.Author, Is.EqualTo("*"));
            Assert.That(name.Name, Is.EqualTo("*"));
            Assert.That(name.Version, Is.EqualTo(-1));
        }
Exemple #3
0
        public static bool TryGet(string filename, out VarPackageName?name)
        {
            var match = _extract.Match(filename);

            if (!match.Success)
            {
                name = null;
                return(false);
            }

            name = new VarPackageName(filename, match.Groups["Author"].Value, match.Groups["Name"].Value, match.Groups["Version"].Value == "*" ? -1 : int.Parse(match.Groups["Version"].Value));
            return(true);
        }
Exemple #4
0
 public VarPackage(VarPackageName name, string path, IList <VarPackageFile> files)
 {
     Name  = name;
     Path  = path;
     Files = files;
 }