Пример #1
0
        public int Invoke()
        {
            // Remove when we incorporate into real help
            if (Help2)
            {
                var rootCommandSource = CommandSource.Create <DotnetCommand>() as DotnetCommandCommandSource;
                var commandSource     = rootCommandSource?.NewCommandCommand;
                return(DisplayListHelp(UxLevel, RenderTo, RenderToFileName, commandSource, true));
            }
            var commonTemplates = "console, classlib";
            var data            = TemplateData.SampleData; // get real data here

            var selector = new Selector();

            selector.AddRange(data.Select(template => new SelectorItem(template.ShortName,
                                                                       template.TemplateName,
                                                                       commonTemplates.Contains(template.ShortName))));
            selector.Sorted = true;
            var shortName = Cli.GetFromPrompt(selector, RenderTo, UxLevel);

            Console.WriteLine(string.IsNullOrWhiteSpace(shortName)
                                ? "Enter a template name or a command"
                                : $"Run {shortName}");
            return(0);
        }
Пример #2
0
        public void addSelectors(IEnumerable <string> selectorVal, string media)
        {
            /*
             * selector splitter for future
             * ([#.>+~\[\s]+)[-\w\]\d]+
             * don't forget to Trim result
             * will need to generate Less or SCSS or Stylus
             * !!!!!!!! NEED NEW HASH RECALCULATION SYSTEM
             * !!!!!!!! NEED SELECTOR + RULES CLEANER
             */
            Media = media == null? media : normalizeMedia(media);
            var selectors = selectorVal.Select(x => normalizeSelector(x)).ToList <string>();

            selectors.Sort();
            var sha1 = System.Security.Cryptography.SHA1.Create();

            byte[] buf  = Encoding.UTF8.GetBytes(string.Join(",", selectors) + Media);
            byte[] hash = sha1.ComputeHash(buf, 0, buf.Length);
            selectorHASH = BitConverter.ToString(hash).Replace("-", "");

            Selector.AddRange(selectors);
        }