Пример #1
0
        protected override void GenerateStyleSheet(OutputGroup outputGroup, IList <InputGroup> inputGroups, SwitchParser switchParser, string outputPath, Encoding outputEncoding)
        {
            if (!FileWriteOperation(outputPath, switchParser.IfNotNull(p => p.Clobber), () =>
            {
                // create the output file, clobbering any existing content
                using (var writer = new StreamWriter(outputPath, false, outputEncoding))
                {
                    if (inputGroups != null && inputGroups.Count > 0)
                    {
                        // for each input file, copy to the output, separating them with a newline (don't need a semicolon like JavaScript does)
                        var addSeparator = false;
                        foreach (var inputGroup in inputGroups)
                        {
                            if (addSeparator)
                            {
                                writer.WriteLine();
                            }
                            else
                            {
                                addSeparator = true;
                            }

                            writer.Write(inputGroup.Source);
                        }
                    }
                }

                return(true);
            }))
            {
                // could not write file
                Log.LogError(Strings.CouldNotWriteOutputFile, outputPath);
            }
        }
Пример #2
0
        protected static SwitchParser ParseConfigSettings(string arguments, SwitchParser defaults)
        {
            // clone the default switch settings, parse the arguments on top of the clone,
            // and then return the clone.
            var switchParser = defaults.IfNotNull(d => d.Clone(), new SwitchParser());

            switchParser.Parse(arguments);
            return(switchParser);
        }