예제 #1
0
        private AutoBundles GetAutoBundles(XElement root)
        {
            var autoBundles = new AutoBundles();

            autoBundles.Bundles = new List <AutoBundle>();
            var autoBundlesEl = root.Element("autoBundles");

            if (autoBundlesEl != null)
            {
                autoBundles.Bundles = root.Descendants("autoBundle").Select(this.AutoBundleReader).ToList();
            }

            return(autoBundles);
        }
예제 #2
0
        private AutoBundles GetAutoBundles(JObject document)
        {
            var autoBundles = new AutoBundles();

            autoBundles.Bundles = new List <AutoBundle>();
            string parseSection = "autoBundles";

            if (document != null && document[parseSection] != null)
            {
                JToken autoBundlesParent = JsonParseOrThrow <JObject>(document[parseSection], parseSection, Path, null);
                autoBundles.Bundles = autoBundlesParent.Select(
                    r =>
                {
                    var currentBundle       = new AutoBundle();
                    var prop                = (JProperty)r;
                    currentBundle.Id        = prop.Name;
                    string parseSectionHint = parseSection + "." + prop.Name;
                    var valueObj            = prop.Value as JObject;
                    if (valueObj != null)
                    {
                        currentBundle.OutputPath       = JsonParseStringOrThrow(valueObj, "outputPath", parseSectionHint, Path);
                        currentBundle.CompressionType  = JsonParseStringOrThrow(valueObj, "compressionType", parseSectionHint, Path);
                        currentBundle.ContainingConfig = Path;
                        currentBundle.Includes         = new List <AutoBundleItem>();
                        if (valueObj["include"] != null)
                        {
                            JToken includeParent   = JsonParseOrThrow <JArray>(valueObj["include"], parseSection, Path, null);
                            currentBundle.Includes = includeParent.Select(x => autoBundleItemFrom(x, parseSectionHint)).ToList();
                        }
                        currentBundle.Excludes = new List <AutoBundleItem>();
                        if (valueObj["exclude"] != null)
                        {
                            JToken excludeParent   = JsonParseOrThrow <JArray>(valueObj["exclude"], parseSection, Path, null);
                            currentBundle.Excludes = excludeParent.Select(x => autoBundleItemFrom(x, parseSectionHint)).ToList();
                        }
                    }

                    return(currentBundle);
                }).ToList();
            }

            return(autoBundles);
        }
예제 #3
0
        private AutoBundles GetAutoBundles(JObject document)
        {
            var autoBundles = new AutoBundles();

            autoBundles.Bundles = new List <AutoBundle>();
            if (document != null && document["autoBundles"] != null)
            {
                autoBundles.Bundles = document["autoBundles"].Select(
                    r =>
                {
                    var currentBundle = new AutoBundle();
                    var prop          = (JProperty)r;
                    currentBundle.Id  = prop.Name;
                    var valueObj      = prop.Value as JObject;
                    if (valueObj != null)
                    {
                        currentBundle.OutputPath       = valueObj["outputPath"] != null ? valueObj["outputPath"].ToString() : null;
                        currentBundle.CompressionType  = valueObj["compressionType"] != null ? valueObj["compressionType"].ToString() : null;
                        currentBundle.ContainingConfig = Path;
                        currentBundle.Includes         = new List <AutoBundleItem>();
                        if (valueObj["include"] != null)
                        {
                            currentBundle.Includes = valueObj["include"].Select(x => autoBundleItemFrom(x)).ToList();
                        }
                        currentBundle.Excludes = new List <AutoBundleItem>();
                        if (valueObj["exclude"] != null)
                        {
                            currentBundle.Excludes = valueObj["exclude"].Select(x => autoBundleItemFrom(x)).ToList();
                        }
                    }

                    return(currentBundle);
                }).ToList();
            }

            return(autoBundles);
        }
예제 #4
0
        private AutoBundles GetAutoBundles(JObject document)
        {
            var autoBundles = new AutoBundles();

            autoBundles.Bundles = new List <AutoBundle>();
            if (document != null && document["autoBundles"] != null)
            {
                autoBundles.Bundles = document["autoBundles"].Select(
                    r =>
                {
                    var currentBundle = new AutoBundle();
                    var prop          = (JProperty)r;
                    currentBundle.Id  = prop.Name;
                    var valueObj      = prop.Value as JObject;
                    if (valueObj != null)
                    {
                        currentBundle.OutputPath       = valueObj["outputPath"] != null ? valueObj["outputPath"].ToString() : null;
                        currentBundle.ContainingConfig = Path;
                        currentBundle.Includes         = new List <AutoBundleItem>();
                        if (valueObj["include"] != null)
                        {
                            currentBundle.Includes = valueObj["include"].Select(
                                x =>
                            {
                                var includesObj = x as JObject;
                                var inclItem    = new AutoBundleItem();
                                if (includesObj == null)
                                {
                                    return(inclItem);
                                }

                                inclItem.BundleId  = includesObj["bundleId"] != null ? includesObj["bundleId"].ToString() : null;
                                inclItem.File      = includesObj["file"] != null ? includesObj["file"].ToString() : null;
                                inclItem.Directory = includesObj["directory"] != null ? includesObj["directory"].ToString() : null;
                                return(inclItem);
                            })
                                                     .ToList();
                        }
                        currentBundle.Excludes = new List <AutoBundleItem>();
                        if (valueObj["exclude"] != null)
                        {
                            currentBundle.Excludes = valueObj["exclude"].Select(
                                x =>
                            {
                                var includesObj = x as JObject;
                                var inclItem    = new AutoBundleItem();
                                if (includesObj == null)
                                {
                                    return(inclItem);
                                }

                                inclItem.BundleId  = includesObj["bundleId"] != null ? includesObj["bundleId"].ToString() : null;
                                inclItem.File      = includesObj["file"] != null ? includesObj["file"].ToString() : null;
                                inclItem.Directory = includesObj["directory"] != null ? includesObj["directory"].ToString() : null;
                                return(inclItem);
                            })
                                                     .ToList();
                        }
                    }

                    return(currentBundle);
                }).ToList();
            }

            return(autoBundles);
        }