Ejemplo n.º 1
0
        private void readCombination(Queue <string> tokens, string verb)
        {
            var assets = new List <string>()
            {
                verb
            };

            while (tokens.Any() && tokens.Peek() != "as")
            {
                assets.Fill(tokens.Dequeue().ToDelimitedArray());
            }

            if (!tokens.Any() || tokens.Dequeue() != "as" || !tokens.Any())
            {
                throw new InvalidSyntaxException("Must supply a combination name");
            }

            var comboName = tokens.Dequeue();

            var hasMultipleMimetypes = assets.Select(x => MimeType.MimeTypeByFileName(x)).Distinct().Count() > 1;

            if (hasMultipleMimetypes)
            {
                throw new InvalidSyntaxException("All members of a combination must be of the same type (script or stylesheet)");
            }

            assets.Each(x => _registration.AddToCombination(comboName, x));
        }
Ejemplo n.º 2
0
        public void AddToCombination(string comboName, string names)
        {
            _logs.FindByName(comboName)
            .Add(_provenance, "Combining {0} into me.".ToFormat(names));

            _logs.FindByName(names)
            .Add(_provenance, "was combined into {0}".ToFormat(comboName));

            _inner.AddToCombination(comboName, names);
        }
Ejemplo n.º 3
0
        private void readCombination(Queue <string> tokens, string verb)
        {
            var assets = new List <string>()
            {
                verb
            };

            while (tokens.Any() && tokens.Peek() != "as")
            {
                assets.Fill(tokens.Dequeue().ToDelimitedArray());
            }

            if (!tokens.Any() || tokens.Dequeue() != "as" || !tokens.Any())
            {
                throw new InvalidSyntaxException("Must supply a combination name");
            }

            var comboName = tokens.Dequeue();

            assets.Each(x => _registration.AddToCombination(comboName, x));
        }