Exemple #1
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);
        }
        /// <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;
        }