Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MergeConfiguration"/> class.
        /// </summary>
        /// <param name="sitecoreConfigurationSwitcher">The Sitecore configuration switcher.</param>
        /// <param name="fileName">The file name.</param>
        /// <param name="xpath">The XPath of the element to merge configuration to.</param>
        public MergeConfiguration(SitecoreConfigurationSwitcher sitecoreConfigurationSwitcher, string fileName, string xpath) : this(sitecoreConfigurationSwitcher)
        {
            const string FileNameDoesNotRepresentAFileMessage = "File name does not represent a file.";

            Assert.ArgumentNotNullOrEmpty(fileName, "fileName");
            Assert.ArgumentNotNullOrEmpty(xpath, "xpath");

            string fileDirectory = Path.GetDirectoryName(fileName);
            string filePattern   = Path.GetFileName(fileName);

            Assert.ArgumentCondition(fileDirectory != null, "fileName", FileNameDoesNotRepresentAFileMessage);
            Assert.ArgumentCondition(!string.IsNullOrEmpty(filePattern), "fileName", FileNameDoesNotRepresentAFileMessage);

            XPathNodeIterator iterator = this.SitecoreConfigurationSwitcher.GetNodeIterator(xpath);
            LinkedList <XPathNodeIterator> elements = new LinkedList <XPathNodeIterator>();

            while (iterator.MoveNext())
            {
                elements.AddLast(iterator.Clone());
            }

            fileDirectory = string.IsNullOrEmpty(fileDirectory) ? "." : fileDirectory;

            foreach (string file in Directory.GetFiles(fileDirectory, filePattern))
            {
                foreach (XPathNodeIterator element in elements)
                {
                    element.MergeContent(file);
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PipelineManager" /> class.
        /// </summary>
        /// <param name="configurationSwitcher">The configuration switcher.</param>
        public PipelineManager(SitecoreConfigurationSwitcher configurationSwitcher)
        {
            Assert.ArgumentNotNull(configurationSwitcher, "configurationSwitcher");

            this.configurationSwitcher = configurationSwitcher;
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MergeConfiguration"/> class.
        /// </summary>
        /// <param name="sitecoreConfigurationSwitcher">The Sitecore configuration switcher.</param>
        protected MergeConfiguration(SitecoreConfigurationSwitcher sitecoreConfigurationSwitcher)
        {
            Assert.ArgumentNotNull(sitecoreConfigurationSwitcher, "sitecoreConfigurationSwitcher");

            this.sitecoreConfigurationSwitcher = sitecoreConfigurationSwitcher;
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MergeConfiguration"/> class.
 /// </summary>
 /// <param name="sitecoreConfigurationSwitcher">The Sitecore configuration switcher.</param>
 /// <param name="fileName">The file Name.</param>
 public MergeConfiguration(SitecoreConfigurationSwitcher sitecoreConfigurationSwitcher, string fileName) : this(sitecoreConfigurationSwitcher, fileName, SitecoreConfigurationRootXPath)
 {
 }