Example #1
0
        public static IManifest GetManifest(this IPackage package)
        {
            var file = package.GetFiles().SingleOrDefault(f => f.Path == "manifest.json");

            if (file == null)
            {
                return(null);
            }

            IManifest manifest;

            return(!Manifest.TryParse(file.GetStream(), out manifest) ? null : manifest);
        }
Example #2
0
        public Manifest Read(JObject manifestObject)
        {
            var manifest = new Manifest();

            foreach (var item in manifestObject)
            {
                Action<Manifest, JToken> parser;

                if (!Parsers.TryGetValue(item.Key, out parser))
                {
                    continue;
                }

                parser(manifest, item.Value);
            }

            return manifest;
        }