Exemplo n.º 1
0
        public void TestMethodSaveFile()
        {
            var manifest = ManifestHelper.Load("Ressources\\Manifest.xml");

            ManifestHelper.Save(manifest, "Manifest.xml");
            Assert.IsTrue(File.Exists("Manifest.xml"));
        }
Exemplo n.º 2
0
        public void TestMethodSaveStream()
        {
            var manifest = ManifestHelper.Load("Ressources\\Manifest.xml");

            using (var stream = new FileStream("Manifest.xml", FileMode.Create, FileAccess.Write))
            {
                ManifestHelper.Save(manifest, stream);
            }
            Assert.IsTrue(File.Exists("Manifest.xml"));
        }
Exemplo n.º 3
0
        public IEnumerable <IPackage> GetPackages(bool onlyLatestVersion = true)
        {
            lock (thisLock)
            {
                var packageList = new List <IPackage>();
                foreach (var packageDir in rootDirectory.GetDirectories())
                {
                    foreach (var versionDir in packageDir.GetDirectories())
                    {
                        if (File.Exists(Path.Combine(versionDir.FullName, Constants.ManifestFileName)))
                        {
                            packageList.Add(ManifestHelper.Load(Path.Combine(versionDir.FullName, Constants.ManifestFileName)));
                        }
                    }
                }

                if (onlyLatestVersion)
                {
                    return(packageList.Where(p => packageList.Where(p1 => p1.Name == p.Name).Select(p2 => new SemanticVersion(p2.Version)).Max().ToNormalizedString() == p.SemanticVersion().ToNormalizedString()).ToList());
                }

                return(packageList);
            }
        }
Exemplo n.º 4
0
        public void TestMethodLoadFromPath()
        {
            var manifest = ManifestHelper.Load("Ressources\\Manifest.xml");

            Assert.IsNotNull(manifest);
        }