Beispiel #1
0
        void UpdateContent()
        {
            SortedList <string, string> keys = new SortedList <string, string>();

            foreach (string v in GetParameters("ContentItems", Parameters.ContentItems, "Content"))
            {
                keys.Add(v, "Item");
            }

            foreach (ProjectItem i in BuildItems)
            {
                if (i.Name.StartsWith("_"))
                {
                    continue;
                }

                string name;
                if (!keys.TryGetValue(i.Name, out name))
                {
                    continue;
                }

                ContentFiles.AddUnique(i.Include);
            }
        }
Beispiel #2
0
        private void FindContentAndScripts(XPathDocument doc)
        {
            SortedList <string, string> extensions = new SortedList <string, string>(StringComparer.OrdinalIgnoreCase);

            if (Parameters.ScriptExtensions != null)
            {
                foreach (string extension in Parameters.ScriptExtensions)
                {
                    string ext = extension;

                    if (!ext.StartsWith("."))
                    {
                        ext = '.' + ext;
                    }

                    if (!extensions.ContainsKey(ext))
                    {
                        extensions.Add(ext, "Item");
                    }
                }
            }

            foreach (XPathNavigator nav in doc.CreateNavigator().Select("//File[@RelativePath]"))
            {
                string file = nav.GetAttribute("RelativePath", "");
                bool   deploymentContent = ("true" == nav.GetAttribute("DeploymentContent", ""));

                if (deploymentContent)
                {
                    ContentFiles.AddUnique(file);
                }

                if (extensions.ContainsKey(Path.GetExtension(file)))
                {
                    ScriptFiles.AddUnique(file);
                }
            }
        }