示例#1
0
        public static int Main(string[] args)
        {
            //BugFix:
            System.Web.Util.HttpEncoder.Current = System.Web.Util.HttpEncoder.Default;

            #if DEBUGx
            args = new string[]{
                "--htmlroot", "TestData",
                "--namespace", "Example",
                "--outputCS", "Generated.cs",
                "--element-property",
                "--generate-classes",
                "--bubble-id",
                "--bubble-class",
                "--outputHTML", "Output",
                "--minimize-names",
                "--inputCSS", Path.Combine("TestData", "style.css"),
                "--outputCSS", Path.Combine("Output", "style.css")
            };
            #endif

            var options = Options.Parse(args);
            if (options == null)
                return -1;

            using (var output = new CSharpSaver(options, ob))
            {
                //Scan HTML
                ScanDir(options, options.WebRoot, output);

                //CSS obfuscation
                if (options.InputCSS != null)
                {
                    CssObfuscator.Obfuscate(options.InputCSS, options.OutputCSS, ob);
                    Console.WriteLine("Obfuscated written to: " + options.OutputCSS);
                }

                if (options.GenerateGlobalClasses)
                {
                    ob.ExportClasses(classes);
                    output.WriteClasses(classes, options);
                    output.WriteSelectors(classes, options);
                }

                Console.WriteLine("Written: " + options.OutputCS);
            }

            //Export obfuscation data
            using (TextWriter tw = new StreamWriter(Path.Combine(options.WebRoot, "obfuscation.txt")))
            {
                tw.Write(ob.Export());
            }

            return 0;
        }