Esempio n. 1
0
        public static IEnumerable <Manifest> GetAllManifests(string path)
        {
            if (!Directory.Exists(DocsExportFolderManager.GetDocsExportFolderPath(path)))
            {
                throw new MissingDocumentationException(string.Concat("Error locating documentation in: ", path))
                      {
                          Path = path
                      }
            }
            ;

            var exportDirectories = Directory.GetDirectories(DocsExportFolderManager.GetDocsExportFolderPath(path));

            var manifests = new List <Manifest>();

            foreach (var directory in exportDirectories)
            {
                string manifestFilePath = Path.Combine(directory, Manifest.FileName);

                if (File.Exists(manifestFilePath))
                {
                    var manifest = Manifest.Load(manifestFilePath);
                    manifest.Path = directory;

                    manifests.Add(manifest);
                }
            }

            return(manifests.OrderByDescending(m => m.Version));
        }
    }
Esempio n. 2
0
        public static Manifest GetCurrentManifest(string version, string applicationRootPath)
        {
            Manifest manifest;

            var manifests = GetAllManifests(applicationRootPath).ToList();

            if (manifests.Count < 1)
            {
                string path = DocsExportFolderManager.GetDocsExportFolderPath(applicationRootPath);
                throw new MissingDocumentationException(string.Concat("Error locating documentation in: ", path))
                      {
                          Path = path
                      };
            }

            if (string.IsNullOrEmpty(version))
            {
                manifest = manifests.Single(d => d.Version == manifests.Select(m => m.Version).Max());
                manifest.IsDefaultLatest = true;
            }
            else
            {
                manifest = manifests.Single(d => d.Version.Equals(version));
            }

            return(manifest);
        }