static void Main(string[] args)
        {
            string output = "output";
            string data   = "data";
            //string web = new FileInfo(Assembly.GetEntryAssembly().Location).Directory.FullName;
            string web    = "web";
            string watch  = "watch";
            bool   delete = false;

            int i = Array.IndexOf(args, "--output");

            if (i >= 0)
            {
                output = args[i + 1];
            }

            i = Array.IndexOf(args, "--data");
            if (i >= 0)
            {
                data = args[i + 1];
            }

            i = Array.IndexOf(args, "--web");
            if (i >= 0)
            {
                web = args[i + 1];
            }

            i = Array.IndexOf(args, "--delete");
            if (i >= 0)
            {
                delete = bool.Parse(args[i + 1]);
            }

            i = Array.IndexOf(args, "--watch");
            if (i >= 0)
            {
                watch = args[i + 1];
            }

            data   = new DirectoryInfo(data).FullName;
            web    = new DirectoryInfo(web).FullName;
            output = new DirectoryInfo(output).FullName;
            watch  = new DirectoryInfo(watch).FullName;

            Paths.Web               = web;
            Paths.Data              = data;
            Paths.Output            = output;
            Paths.Watch             = watch;
            GeneratorService.Delete = delete;

            Database.Init();

            bool gen_cache = !FileCache.CacheDirExists();

            Console.WriteLine("Data directory: {0}", data);
            Console.WriteLine("Web directory: {0}", web);
            Console.WriteLine("Output directory: {0}", output);

            if (Directory.Exists(watch))
            {
                Console.WriteLine("Watch directory: {0}", watch);
                Watcher.Init(watch);
            }

            var appHost = new DownSiteAppHost(web);


            /*
             * var pathProviders = new List<IVirtualPathProvider> {
             *  new FileSystemVirtualPathProvider(appHost, appHost.Config.WebHostPhysicalPath),
             *  new FileSystemVirtualPathProvider(appHost, appHost.Config.WebHostPhysicalPath)
             * };
             *
             * appHost.VirtualPathProvider = pathProviders.Count > 1
             *  ? new MultiVirtualPathProvider(appHost, pathProviders.ToArray())
             *  : pathProviders.First();*/



            appHost.Init();
            appHost.Start(BaseUri);
            Console.WriteLine("Listening on " + BaseUri);


            if (gen_cache)
            {
                Console.WriteLine("Generating image cache...");
                Image.GenerateCache();
                Console.WriteLine("done.");
            }

            string line;

            do
            {
                Console.WriteLine("Press return to generate the page");
                line = Console.ReadLine();
                if (line.Length == 0)
                {
                    Static.Generate(output, data, delete);
                }
            }while (line.Length == 0);
        }