Ejemplo n.º 1
0
        private CatalogueBuild Discover(List <DirectoryInfo> dirs)
        {
            var cat = new CatalogueBuild();

            foreach (var d in dirs)
            {
                foreach (var sd in d.GetDirectories())
                {
                    try
                    {
                        var entry = CataloguePackageBuilder.Rebuild(sd);
                        if (entry != null)
                        {
                            cat.Add(entry);
                        }
                    }
                    catch (Exception e)
                    {
                        _context.L.Error(e.Message + " in " + sd.FullName);
                    }
                }
            }

            return(cat);
        }
Ejemplo n.º 2
0
        private Catalogue CreateJsonObject(CatalogueBuild catalogueBuild)
        {
            var cs = new Catalogue {
                Owner = "prime"
            };

            foreach (var group in catalogueBuild.GroupBy(x => x.MetaData.Id).Where(x => x.Any()))
            {
                var ces = new CataloguePackage()
                {
                    Id = group.Key, Title = group.First().MetaData?.Title
                };
                cs.Entries.Add(ces);

                foreach (var i in group)
                {
                    ces.Instances.Add(new CatalogueInstance(i.MetaData));
                }
            }

            return(cs);
        }