Пример #1
0
        /// <summary>
        /// Logs the target file header information via an IRenderConfigLogger.
        /// </summary>
        /// <param name="targetFile">The target file.</param>
        /// <param name="Log">The log.</param>
        public static void LogTargetFileHeader(string source, string destination, string sourceDir, string destinationDir, IRenderConfigLogger Log)
        {
            FileInfo destinationFile;
            FileInfo sourceFile = new FileInfo(source);
            if (string.IsNullOrEmpty(sourceDir))
            {
                sourceDir = string.Empty;
            }
            if (string.IsNullOrEmpty(destinationDir))
            {
                destinationDir = string.Empty;
            }

            if (String.IsNullOrEmpty(destination))
            {
                destinationFile = new FileInfo(source);
            }
            else
            {
                destinationFile = new FileInfo(destination);
            }
          
            Log.LogMessage(MessageImportance.High, "SOURCE = ".PadLeft(15) + Path.Combine(sourceDir,sourceFile.Name));
            Log.LogMessage("TARGET = ".PadLeft(15) + Path.Combine(destinationDir, destinationFile.Name));
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IniFileModifier"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="targetFile">The target file.</param>
 /// <param name="log">The log.</param>
 /// <param name="breakOnNoMatch">if set to <c>true</c> [break on no match].</param>
 public IniFileModifier(IniTargetFile file, string targetFile, IRenderConfigLogger log, RenderConfigConfig config)
 {
     this.file = file;
     this.log = log;
     this.config = config;
     this.targetFile = targetFile;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IniFileModifier"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="targetFile">The target file.</param>
 /// <param name="log">The log.</param>
 /// <param name="breakOnNoMatch">if set to <c>true</c> [break on no match].</param>
 public IniFileModifier(IniTargetFile file, string targetFile, IRenderConfigLogger log, RenderConfigConfig config)
 {
     this.file       = file;
     this.log        = log;
     this.config     = config;
     this.targetFile = targetFile;
 }
Пример #4
0
        /// <summary>
        /// Applies the specified config by passing through each set of modifications (in order, deterministic).
        /// </summary>
        /// <param name="config">The config.</param>
        /// <param name="inputLog">The input log.</param>
        /// <returns></returns>
        public Boolean Apply(RenderConfigConfig config, IRenderConfigLogger inputLog)
        {
            log = inputLog;
            Boolean returnCode = true;

            foreach (XmlTargetFile file in TargetFiles.XML)
            {
                CheckAndModifySourceAndDestination(config, file);
                //If we arent doing anything else, we are doing a straight copy...
                if (file.Add == null & file.Delete == null && file.Update == null && file.Replace == null)
                {
                    log.LogMessage(MessageImportance.High, "TYPE = ".PadLeft(27) + "substitute");
                    RenderConfigEngine.Substitute(file, config.OutputDirectory);
                }
                else
                {
                    IFileModifier fileModifier = new XmlFileModifier(file, RenderConfigEngine.ResolveAndCopyDestinationFilename(file, config.OutputDirectory, true), log, config);
                    fileModifier.Run();
                }
            }

            foreach (IniTargetFile file in TargetFiles.INI)
            {
                CheckAndModifySourceAndDestination(config, file);
                //If we arent doing anything else, we are doing a straight copy...
                //TODO possibly add all these checks as a boolean get{} on the partial class..so if (file.IsSimpleCopy)
                if (file.Add == null & file.Delete == null && file.Update == null && file.Replace == null)
                {
                    log.LogMessage(MessageImportance.High, "TYPE = ".PadLeft(27) + "substitute");
                    RenderConfigEngine.Substitute(file, config.OutputDirectory);
                }
                else
                {
                    IFileModifier fileModifier = new IniFileModifier(file, RenderConfigEngine.ResolveAndCopyDestinationFilename(file, config.OutputDirectory, true), log, config);
                    fileModifier.Run();
                }
            }

            foreach (TxtTargetFile file in TargetFiles.TXT)
            {
                CheckAndModifySourceAndDestination(config, file);
                //If we arent doing anything else, we are doing a straight copy...
                if (file.Replace == null)
                {
                    log.LogMessage(MessageImportance.High, "TYPE = ".PadLeft(27) + "substitute");
                    RenderConfigEngine.Substitute(file, config.OutputDirectory);
                }
                else
                {
                    IFileModifier fileModifier = new TxtFileModifier(file, RenderConfigEngine.ResolveAndCopyDestinationFilename(file, config.OutputDirectory, true), log, config);
                    fileModifier.Run();
                }
            }

            return(returnCode);
        }
Пример #5
0
        /// <summary>
        /// Applies the specified config by passing through each set of modifications (in order, deterministic).
        /// </summary>
        /// <param name="config">The config.</param>
        /// <param name="inputLog">The input log.</param>
        /// <returns></returns>
        public Boolean Apply(RenderConfigConfig config, IRenderConfigLogger inputLog)
        {
            log = inputLog;
            Boolean returnCode = true;

            foreach (XmlTargetFile file in TargetFiles.XML)
            {
                CheckAndModifySourceAndDestination(config, file);
                //If we arent doing anything else, we are doing a straight copy...
                if (file.Add == null & file.Delete == null && file.Update == null && file.Replace == null)
                {
                    log.LogMessage(MessageImportance.High, "TYPE = ".PadLeft(27) + "substitute");
                    RenderConfigEngine.Substitute(file, config.OutputDirectory);
                }
                else
                {
                    IFileModifier fileModifier = new XmlFileModifier(file, RenderConfigEngine.ResolveAndCopyDestinationFilename(file, config.OutputDirectory, true), log, config);
                    fileModifier.Run();
                }
            }

            foreach (IniTargetFile file in TargetFiles.INI)
            {
                CheckAndModifySourceAndDestination(config, file);
                //If we arent doing anything else, we are doing a straight copy...
                //TODO possibly add all these checks as a boolean get{} on the partial class..so if (file.IsSimpleCopy)
                if (file.Add == null & file.Delete == null && file.Update == null && file.Replace == null)
                {
                    log.LogMessage(MessageImportance.High, "TYPE = ".PadLeft(27) + "substitute");
                    RenderConfigEngine.Substitute(file, config.OutputDirectory);
                }
                else
                {
                    IFileModifier fileModifier = new IniFileModifier(file, RenderConfigEngine.ResolveAndCopyDestinationFilename(file, config.OutputDirectory, true), log, config);
                    fileModifier.Run();
                }
            }

            foreach (TxtTargetFile file in TargetFiles.TXT)
            {
                CheckAndModifySourceAndDestination(config, file);
                //If we arent doing anything else, we are doing a straight copy...
                if (file.Replace == null)
                {
                    log.LogMessage(MessageImportance.High, "TYPE = ".PadLeft(27) + "substitute");
                    RenderConfigEngine.Substitute(file, config.OutputDirectory);
                }
                else
                {
                    IFileModifier fileModifier = new TxtFileModifier(file, RenderConfigEngine.ResolveAndCopyDestinationFilename(file, config.OutputDirectory, true), log, config);
                    fileModifier.Run();
                }
            }

            return returnCode;
        }
Пример #6
0
        /// <summary>
        /// Logs an int as a count.
        /// </summary>
        /// <param name="count">The count.</param>
        /// <param name="log">The log.</param>
        public static void LogCount(int count, IRenderConfigLogger log)
        {
            if (count == 0)
            {
                log.LogMessage(MessageImportance.High, "COUNT = ".PadLeft(27) + count);
            }
            else
            {
                log.LogMessage("COUNT = ".PadLeft(27) + count);
            }

            log.LogMessage("");
        }
Пример #7
0
 /// <summary>
 /// Logs the RenderConfigConfig settings provided to the IRenderConfigLogger instance passed in.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="log">The log.</param>
 public static void LogSettings(RenderConfigConfig config, IRenderConfigLogger log)
 {
     log.LogMessage("--------------------------------------------------------");
     log.LogMessage(string.Concat("Config File = ".PadLeft(30) + config.ConfigFile));
     log.LogMessage(string.Concat("Configuration = ".PadLeft(30) + config.Configuration));
     log.LogMessage(string.Concat("Input Directory = ".PadLeft(30) + config.InputDirectory));
     log.LogMessage(string.Concat("Output Directory = ".PadLeft(30) + config.OutputDirectory));
     log.LogMessage(string.Concat("Delete Output Directory = ".PadLeft(30) + config.DeleteOutputDirectory));
     log.LogMessage(string.Concat("Break On No Match = ".PadLeft(30) + config.BreakOnNoMatch));
     log.LogMessage(string.Concat("Clean XML Output = ".PadLeft(30) + config.CleanOutput));
     log.LogMessage(string.Concat("Preserve Source Structure = ".PadLeft(30) + config.PreserveSourceStructure));
     log.LogMessage(string.Concat("Subdirectory per Config = ".PadLeft(30) + config.SubDirectoryEachConfiguration));
     log.LogMessage("--------------------------------------------------------");
 }
Пример #8
0
 /// <summary>
 /// Logs the RenderConfigConfig settings provided to the IRenderConfigLogger instance passed in.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="log">The log.</param>
 public static void LogSettings(RenderConfigConfig config, IRenderConfigLogger log)
 {
     log.LogMessage("--------------------------------------------------------");
     log.LogMessage(string.Concat("Config File = ".PadLeft(30) + config.ConfigFile));
     log.LogMessage(string.Concat("Configuration = ".PadLeft(30) + config.Configuration));
     log.LogMessage(string.Concat("Input Directory = ".PadLeft(30) + config.InputDirectory));
     log.LogMessage(string.Concat("Output Directory = ".PadLeft(30) + config.OutputDirectory));
     log.LogMessage(string.Concat("Delete Output Directory = ".PadLeft(30) + config.DeleteOutputDirectory));
     log.LogMessage(string.Concat("Break On No Match = ".PadLeft(30) + config.BreakOnNoMatch));
     log.LogMessage(string.Concat("Clean XML Output = ".PadLeft(30) + config.CleanOutput));
     log.LogMessage(string.Concat("Preserve Source Structure = ".PadLeft(30) + config.PreserveSourceStructure));
     log.LogMessage(string.Concat("Subdirectory per Config = ".PadLeft(30) + config.SubDirectoryEachConfiguration));
     log.LogMessage("--------------------------------------------------------");
 }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlFileModifier"/> class.
        /// </summary>
        public XmlFileModifier(XmlTargetFile file, string targetFile, IRenderConfigLogger log, RenderConfigConfig config)
        {
            this.file       = file;
            this.log        = log;
            this.config     = config;
            this.targetFile = targetFile;

            //Get the document and set up the XmlReaderSettings
            document = new XmlDocument();
            settings = GetXmlReaderSettings(config.CleanOutput, document);

            using (XmlReader xml = XmlReader.Create(targetFile, settings))
            {
                document.Load(xml);
            }
        }
Пример #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlFileModifier"/> class.
        /// </summary>
        public XmlFileModifier(XmlTargetFile file, string targetFile, IRenderConfigLogger log, RenderConfigConfig config)
        {
            this.file = file;
            this.log = log;
            this.config = config;
            this.targetFile = targetFile;

            //Get the document and set up the XmlReaderSettings
            document = new XmlDocument();
            settings = GetXmlReaderSettings(config.CleanOutput, document);

            using (XmlReader xml = XmlReader.Create(targetFile, settings))
            {
                document.Load(xml);
            }

        }
Пример #11
0
        public static Boolean RunAllConfigurations(RenderConfigConfig config, IRenderConfigLogger log)
        {
            Boolean returnBool = false;

            if (config.Configuration.Contains(","))
            {
                string[] configs = config.Configuration.Split(',');
                foreach (string configToRun in configs)
                {
                    RenderConfigConfig newConfig = (RenderConfigConfig)config.Clone();
                    newConfig.Configuration = configToRun;
                    if (config.SubDirectoryEachConfiguration)
                    {
                        newConfig.OutputDirectory = Path.Combine(newConfig.OutputDirectory, configToRun);
                    }
                    RenderConfigEngine engine = new RenderConfigEngine(newConfig, log);
                    returnBool = engine.Render();
                }
            }
            else
            {
                if (config.SubDirectoryEachConfiguration)
                {
                    if (!String.IsNullOrEmpty(config.OutputDirectory))
                    {
                        config.OutputDirectory = Path.Combine(config.OutputDirectory, config.Configuration);
                    }
                    else
                    {
                        config.OutputDirectory = config.Configuration;
                    }
                }

                RenderConfigEngine engine = new RenderConfigEngine(config, log);
                return(engine.Render());
            }

            return(returnBool);
        }
Пример #12
0
        /// <summary>
        /// Logs the modification details.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="regex">The regex.</param>
        /// <param name="log">The log.</param>
        private static void LogModificationDetails(string section, string key, string value, string regex, IRenderConfigLogger log)
        {
            if (String.IsNullOrEmpty(section))
            {
                LogUtilities.LogKeyValue("SECTION", section, 27, MessageImportance.Normal, log);
            }

            if (String.IsNullOrEmpty(key))
            {
                LogUtilities.LogKeyValue("KEY", key, 27, MessageImportance.Normal, log);
            }

            //Dont output if we are deleting a key, it just doesnt make sense
            if (!String.IsNullOrEmpty(value))
            {
                LogUtilities.LogKeyValue("VALUE", value.Trim(), 27, MessageImportance.Normal, log);
            }
        }
Пример #13
0
        /// <summary>
        /// Logs the modification details.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="regex">The regex.</param>
        /// <param name="log">The log.</param>
        private static void LogModificationDetails(string section, string key, string value, string regex, IRenderConfigLogger log)
        {
            if (String.IsNullOrEmpty(section))
            {
                LogUtilities.LogKeyValue("SECTION", section, 27, MessageImportance.Normal, log);
            }

            if (String.IsNullOrEmpty(key))
            {
                LogUtilities.LogKeyValue("KEY", key, 27, MessageImportance.Normal, log);
            }

            //Dont output if we are deleting a key, it just doesnt make sense
            if (!String.IsNullOrEmpty(value))
            {
                LogUtilities.LogKeyValue("VALUE", value.Trim(), 27, MessageImportance.Normal, log);
            }
        }
Пример #14
0
 /// <summary>
 /// Logs the count of applied modifications.
 /// </summary>
 /// <param name="log">The log.</param>
 private void LogCount(IRenderConfigLogger log)
 {
     LogUtilities.LogCount(1, log);
 }
Пример #15
0
        /// <summary>
        /// Parses an XMLDocument and returns an XML namespace manager.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="log">The log.</param>
        /// <returns></returns>
        private static XmlNamespaceManager ParseAndReturnXmlNamespaceManager(XmlDocument document, IRenderConfigLogger log)
        {
            Regex namespaces = new Regex(@"xmlns:?(?<ns>[a-zA-Z]*)=""(?<url>((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*))""");
            MatchCollection matches = namespaces.Matches(document.OuterXml);
            XmlNamespaceManager manager = new XmlNamespaceManager(document.NameTable);

            if (matches.Count > 0)
            {
                foreach (Match match in matches)
                {
                    if (!manager.HasNamespace(match.Groups["ns"].ToString()))
                    {
                        //We will use "r" as our pretend namespace
                        string ns = "r";
                        if (!String.IsNullOrEmpty(match.Groups["ns"].Value))
                        {
                            ns = match.Groups["ns"].ToString();
                        }

                        log.LogMessage(MessageImportance.High, string.Concat("Adding XML Namespace : ".PadLeft(27) + ns + " = " + match.Groups["url"]));
                        manager.AddNamespace(ns, match.Groups["url"].ToString());
                    }
                }
            }
            return manager;
        }
Пример #16
0
        /// <summary>
        /// Logs the target file header information via an IRenderConfigLogger.
        /// </summary>
        /// <param name="targetFile">The target file.</param>
        /// <param name="Log">The log.</param>
        public static void LogTargetFileHeader(string source, string destination, string sourceDir, string destinationDir, IRenderConfigLogger Log)
        {
            FileInfo destinationFile;
            FileInfo sourceFile = new FileInfo(source);

            if (string.IsNullOrEmpty(sourceDir))
            {
                sourceDir = string.Empty;
            }
            if (string.IsNullOrEmpty(destinationDir))
            {
                destinationDir = string.Empty;
            }

            if (String.IsNullOrEmpty(destination))
            {
                destinationFile = new FileInfo(source);
            }
            else
            {
                destinationFile = new FileInfo(destination);
            }

            Log.LogMessage(MessageImportance.High, "SOURCE = ".PadLeft(15) + Path.Combine(sourceDir, sourceFile.Name));
            Log.LogMessage("TARGET = ".PadLeft(15) + Path.Combine(destinationDir, destinationFile.Name));
        }
Пример #17
0
 /// <summary>
 /// Logs a key value pair as "Key = Value".
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <param name="padding">The padding.</param>
 /// <param name="importance">The importance.</param>
 /// <param name="log">The log.</param>
 public static void LogKeyValue(string key, string value, int padding, MessageImportance importance, IRenderConfigLogger log)
 {
     log.LogMessage(importance, string.Concat(string.Concat(key, " = ").PadLeft(padding), value));
 }
Пример #18
0
 /// <summary>
 /// Logs the modification details.
 /// </summary>
 /// <param name="xpath">The xpath.</param>
 /// <param name="attribute">The attribute.</param>
 /// <param name="value">The value.</param>
 /// <param name="regex">The regex.</param>
 /// <param name="log">The log.</param>
 private static void LogModificationDetails(string xpath, string attribute, string value, string regex, IRenderConfigLogger log)
 {
     if (!String.IsNullOrEmpty(xpath))
     {
         LogUtilities.LogKeyValue("XPATH", xpath, 27, MessageImportance.Normal, log);
     }
     if (!String.IsNullOrEmpty(attribute))
     {
         LogUtilities.LogKeyValue("ATTRIBUTE", attribute, 27, MessageImportance.Normal, log);
     }
     if (!String.IsNullOrEmpty(value))
     {
         LogUtilities.LogKeyValue("VALUE", value, 27, MessageImportance.Normal, log);
     } 
     if (!String.IsNullOrEmpty(regex))
     {
         LogUtilities.LogKeyValue("REGEX", regex, 27, MessageImportance.Normal, log);
     }
 }
Пример #19
0
        /// <summary>
        /// Generates the node list.
        /// </summary>
        /// <param name="configs">The configs.</param>
        private static List <Node <string> > GenerateNodeList(RenderConfig renderConfig, IRenderConfigLogger log)
        {
            //Create list of all nodes, without dependencies
            log.LogMessage("Generating Node List...");
            List <Node <string> > nodes = CreateInitialNodeList(renderConfig);

            foreach (Configuration config in renderConfig.Configurations)
            {
                //Split the dependencies, and then for each of them find a node in nodeList, and add as a dependency
                if (!String.IsNullOrEmpty(config.Depends))
                {
                    string[] dependencies = config.Depends.Split(',', ';');
                    foreach (string depends in dependencies)
                    {
                        Node <string> dependencyNode = SearchForNodeByIdentity(nodes, depends.Trim());
                        if (dependencyNode == null)
                        {
                            throw new ApplicationException("Error in configuration, cannot resolve dependency " + depends);
                        }
                        else
                        {
                            SearchForNodeByIdentity(nodes, config.Name).Dependencies.Add(dependencyNode);
                        }
                    }
                }
            }

            return(nodes);
        }
Пример #20
0
 /// <summary>
 /// Logs a key value pair as "Key = Value".
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <param name="padding">The padding.</param>
 /// <param name="importance">The importance.</param>
 /// <param name="log">The log.</param>
 public static void LogKeyValue(string key, string value, int padding, MessageImportance importance, IRenderConfigLogger log)
 {
     log.LogMessage(importance, string.Concat(string.Concat(key, " = ").PadLeft(padding), value));
 }
Пример #21
0
 /// <summary>
 /// Logs the modification details.
 /// </summary>
 /// <param name="xpath">The xpath.</param>
 /// <param name="attribute">The attribute.</param>
 /// <param name="value">The value.</param>
 /// <param name="regex">The regex.</param>
 /// <param name="log">The log.</param>
 private static void LogModificationDetails(string xpath, string attribute, string value, string regex, IRenderConfigLogger log)
 {
     if (!String.IsNullOrEmpty(xpath))
     {
         LogUtilities.LogKeyValue("XPATH", xpath, 27, MessageImportance.Normal, log);
     }
     if (!String.IsNullOrEmpty(attribute))
     {
         LogUtilities.LogKeyValue("ATTRIBUTE", attribute, 27, MessageImportance.Normal, log);
     }
     if (!String.IsNullOrEmpty(value))
     {
         LogUtilities.LogKeyValue("VALUE", value, 27, MessageImportance.Normal, log);
     }
     if (!String.IsNullOrEmpty(regex))
     {
         LogUtilities.LogKeyValue("REGEX", regex, 27, MessageImportance.Normal, log);
     }
 }
Пример #22
0
        /// <summary>
        /// Parses an XMLDocument and returns an XML namespace manager.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="log">The log.</param>
        /// <returns></returns>
        private static XmlNamespaceManager ParseAndReturnXmlNamespaceManager(XmlDocument document, IRenderConfigLogger log)
        {
            Regex               namespaces = new Regex(@"xmlns:?(?<ns>[a-zA-Z]*)=""(?<url>((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*))""");
            MatchCollection     matches    = namespaces.Matches(document.OuterXml);
            XmlNamespaceManager manager    = new XmlNamespaceManager(document.NameTable);

            if (matches.Count > 0)
            {
                foreach (Match match in matches)
                {
                    if (!manager.HasNamespace(match.Groups["ns"].ToString()))
                    {
                        //We will use "r" as our pretend namespace
                        string ns = "r";
                        if (!String.IsNullOrEmpty(match.Groups["ns"].Value))
                        {
                            ns = match.Groups["ns"].ToString();
                        }

                        log.LogMessage(MessageImportance.High, string.Concat("Adding XML Namespace : ".PadLeft(27) + ns + " = " + match.Groups["url"]));
                        manager.AddNamespace(ns, match.Groups["url"].ToString());
                    }
                }
            }
            return(manager);
        }
Пример #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderConfigEngine"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="log">The IRenderConfigLogger to use.</param>
 public RenderConfigEngine(RenderConfigConfig config, IRenderConfigLogger log)
 {
     this.log    = log;
     this.config = config;
 }
Пример #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderConfigEngine"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="log">The IRenderConfigLogger to use.</param>
 public RenderConfigEngine(RenderConfigConfig config, IRenderConfigLogger log)
 {
     this.log = log;
     this.config = config;
 }
Пример #25
0
 /// <summary>
 /// Logs the count of applied modifications.
 /// </summary>
 /// <param name="log">The log.</param>
 private void LogCount(IRenderConfigLogger log)
 {
     LogUtilities.LogCount(1, log);
 }
Пример #26
0
        public static Boolean RunAllConfigurations(RenderConfigConfig config, IRenderConfigLogger log)
        {
            Boolean returnBool = false;
            if (config.Configuration.Contains(","))
            {
                string[] configs = config.Configuration.Split(',');
                foreach (string configToRun in configs)
                {
                    RenderConfigConfig newConfig = (RenderConfigConfig)config.Clone();
                    newConfig.Configuration = configToRun;
                    if (config.SubDirectoryEachConfiguration)
                    {
                        newConfig.OutputDirectory = Path.Combine(newConfig.OutputDirectory, configToRun);
                    }
                    RenderConfigEngine engine = new RenderConfigEngine(newConfig, log);
                    returnBool = engine.Render();
                }
            }
            else
            {
				if (config.SubDirectoryEachConfiguration)
				{
					if (!String.IsNullOrEmpty(config.OutputDirectory))
					{
						config.OutputDirectory = Path.Combine(config.OutputDirectory, config.Configuration);
					}
					else
					{
						config.OutputDirectory = config.Configuration;
					}
				}

                RenderConfigEngine engine = new RenderConfigEngine(config, log);
                return engine.Render();
            }

            return returnBool;
        }
Пример #27
0
 /// <summary>
 /// Logs an int as a count.
 /// </summary>
 /// <param name="count">The count.</param>
 /// <param name="log">The log.</param>
 public static void LogCount(int count, IRenderConfigLogger log)
 {
     if (count == 0)
     {
         log.LogMessage(MessageImportance.High,"COUNT = ".PadLeft(27) + count);
     }
     else
     {
         log.LogMessage("COUNT = ".PadLeft(27) + count);
     }
     
     log.LogMessage("");
 }
Пример #28
0
        /// <summary>
        /// Generates the node list.
        /// </summary>
        /// <param name="configs">The configs.</param>
        private static List<Node<string>> GenerateNodeList(RenderConfig renderConfig, IRenderConfigLogger log)
        {
            //Create list of all nodes, without dependencies
            log.LogMessage("Generating Node List...");
            List<Node<string>> nodes = CreateInitialNodeList(renderConfig);

            foreach (Configuration config in renderConfig.Configurations)
            {
                //Split the dependencies, and then for each of them find a node in nodeList, and add as a dependency
                if (!String.IsNullOrEmpty(config.Depends))
                {
                    string[] dependencies = config.Depends.Split(',', ';');
                    foreach (string depends in dependencies)
                    {
                        Node<string> dependencyNode = SearchForNodeByIdentity(nodes, depends.Trim());
                        if (dependencyNode == null)
                        {
                            throw new ApplicationException("Error in configuration, cannot resolve dependency " + depends);
                        }
                        else
                        {
                            SearchForNodeByIdentity(nodes, config.Name).Dependencies.Add(dependencyNode);
                        }
                    }
                }
            }

            return nodes;
        }