Beispiel #1
0
 private static object Methods(Type type)
 => FactoryNames
 .Select(name => Method(type, name))
 .FirstOrDefault(value => value is Type);
Beispiel #2
0
        public void ToEdit(IValueProvider valueProvider)
        {
            var cssFiles  = valueProvider.GetFiles(FileType.Css);
            var jsFiles   = valueProvider.GetFiles(FileType.Js);
            var htmlFiles = valueProvider.GetFiles(FileType.Html);

            var idsFreqList        = new FreqList <string>();
            var classNamesFreqList = new FreqList <string>();

            var cssIdsSearcher        = new CssV.CssIdsSearcher();
            var cssClassNamesSearcher = new CssV.CssClassNamesSearcher();

            foreach (var item in cssFiles)
            {
                cssIdsSearcher.Search(item.Tree, idsFreqList);
                cssClassNamesSearcher.Search(item.Tree, classNamesFreqList);
            }


            var htmlIdsSercher         = new HtmlV.HtmlIdsSercher();
            var htmlClassNamesSearcher = new HtmlV.HtmlClassNamesSearcher();

            foreach (var item in htmlFiles)
            {
                htmlIdsSercher.Search(item.Tree, idsFreqList);
                htmlClassNamesSearcher.Search(item.Tree, classNamesFreqList);
            }

            INameGenerator nameGen      = new NameGenerator();
            IFactoryNames  factoryNames = new FactoryNames(nameGen);

            var idsMap        = GetMapNames(idsFreqList.GetOrderedList(), factoryNames);
            var classNamesMap = GetMapNames(classNamesFreqList.GetOrderedList(), factoryNames);

            var cssIdsEditor        = new CssV.CssIdsEditor();
            var cssClassNamesEditor = new CssV.CssClassNamesEditor();

            foreach (var item in cssFiles)
            {
                cssIdsEditor.Replace(item.Tree, idsMap);
                cssClassNamesEditor.Replace(item.Tree, classNamesMap);
            }

            var htmlIdsEditor        = new HtmlV.HtmlIdsEditor();
            var htmlClassNamesEditor = new HtmlV.HtmlClassNamesEditor();

            foreach (var item in htmlFiles)
            {
                htmlIdsEditor.Replace(item.Tree, idsMap);
                htmlClassNamesEditor.Replace(item.Tree, classNamesMap);
            }

            var jsIdsEditor        = new JsV.JsIdsEditor();
            var jsClassNamesEditor = new JsV.JsClassNamesEditor();

            foreach (var item in jsFiles)
            {
                jsIdsEditor.Replace(item.Tree, valueProvider, idsMap);
                jsClassNamesEditor.Replace(item.Tree, valueProvider, classNamesMap);
            }
        }
Beispiel #3
0
 private static object Properties(Type type)
 => FactoryNames
 .Select(name => Property(type, name))
 .FirstOrDefault(value => value is Type);