示例#1
0
        static void Main(string[] args)
        {
            var options = new CLOptions();

            Console.WriteLine(GetGilesFunnyLine());

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var parser = new CommandLineParser(
                new CommandLineParserSettings(false, Console.Error));

            if (!parser.ParseArguments(args, options))
            {
                Console.WriteLine("Unable to determine what command lines arguments were used, check the help above!\nThe minimum needed is the -s [solution file path].");
                Environment.Exit(1);
            }

            config = GetGilesConfigFor(options);

            kernel = new StandardKernel(new SlayerModule(config));

            ConsoleSetup();

            sourceWatcher = StartSourceWatcher();

            menuOptions = GetInteractiveMenuOptions();

            DisplayInteractiveMenuOptions();

            MainFeedbackLoop();
        }
示例#2
0
        public ServerStartup(ServerConfig config, bool enableDiagnostics = false, string diagnosticsPassword = "")
        {
            serverConfig = config;
            sites        = new Dictionary <string, WikiSite>();

            // TODO: Investigate event ordering if these two schedulers are in fact the same (slow handling seems to cause notifications out of order)
            notificationScheduler = new EventLoopScheduler(threadStart => new Thread(threadStart)
            {
                Name = "NotificationScheduler"
            });
            modelSyncScheduler = new EventLoopScheduler(threadStart => new Thread(threadStart)
            {
                Name = "ModelSyncScheduler"
            });

            foreach (var wikiConfig in config.AllConfig)
            {
                // get the relevant repositories
                MasterRepository masterRepository;
                IPageCache       pageCache;
                if (serverConfig.TryGetMasterRepository(wikiConfig.SiteName, out masterRepository) &&
                    serverConfig.TryGetPageCache(wikiConfig.SiteName, out pageCache))
                {
                    var sourceWatcher = new SourceWatcher(wikiConfig.RootSourcePath, wikiConfig.Convertor.FileSearchString);

                    // create site
                    var site = new WikiSite(wikiConfig, masterRepository, sourceWatcher, pageCache);

                    // subscribe to all the sites events for notification purposes
                    EventHelper.SubscribeToWikiEvent <WikiSiteEventArgs>(site, "PageAdded", notificationScheduler, (args) => HandleEvent(site.Name, args.WikiUrl));
                    EventHelper.SubscribeToWikiEvent <WikiSiteEventArgs>(site, "PageUpdated", notificationScheduler, (args) => HandleEvent(site.Name, args.WikiUrl));
                    EventHelper.SubscribeToWikiEvent <WikiSiteEventArgs>(site, "PageDeleted", notificationScheduler, (args) => HandleEvent(site.Name, args.WikiUrl));
                    EventHelper.SubscribeToWikiEvent <WikiSiteEventArgs>(site, "PageMoved", notificationScheduler, (args) => HandleEvent(site.Name, args.WikiUrl));
                    EventHelper.SubscribeToWikiEvent <WikiSiteEventArgs>(site, "DirectoryAdded", notificationScheduler, (args) => HandleEvent(site.Name, args.WikiUrl));
                    EventHelper.SubscribeToWikiEvent <WikiSiteEventArgs>(site, "DirectoryUpdated", notificationScheduler, (args) => HandleEvent(site.Name, args.WikiUrl));
                    EventHelper.SubscribeToWikiEvent <WikiSiteEventArgs>(site, "DirectoryDeleted", notificationScheduler, (args) => HandleEvent(site.Name, args.WikiUrl));
                    EventHelper.SubscribeToWikiEvent <WikiSiteEventArgs>(site, "DirectoryMoved", notificationScheduler, (args) => HandleEvent(site.Name, args.WikiUrl));

                    // store
                    sites[wikiConfig.SiteName] = site;
                }
            }

            WikiBootstrapper bootstrapper = new WikiBootstrapper(config, enableDiagnostics, diagnosticsPassword);

            nancyHost   = new NancyHost(new Uri("http://localhost:8070/"), bootstrapper);
            signalrHost = new Server("http://localhost:8071/");
        }
示例#3
0
        static void Main(string[] args)
        {
            var options = new CLOptions();

            var parser = new CommandLineParser(
                new CommandLineParserSettings(false, Console.Error));

            if (!parser.ParseArguments(args, options))
            {
                Environment.Exit(1);
            }

            Console.Clear();
            Console.CancelKeyPress += Console_CancelKeyPress;
            Console.WriteLine("Giles - your own personal watcher");

            var solutionPath     = options.SolutionPath;
            var testAssemblyPath = options.TestAssemblyPath;
            var projectRoot      = options.ProjectRoot;

            var kernel = new StandardKernel(new SlayerModule(solutionPath, testAssemblyPath, projectRoot));

            var configFactory = kernel.Get <GilesConfigFactory>();

            config = configFactory.Build();

            sourceWatcher = kernel.Get <SourceWatcher>();

            sourceWatcher.Watch(solutionPath, @"*.cs");

            DisplayOptions();

            MainFeedbackLoop();

            Console.WriteLine("See you next time...");
        }