Exemplo n.º 1
0
        static void StartUp(string[] args)
        {
            Thread.CurrentThread.Name = "Main";

            string coreDirectory = "D:\\ickletest";

            File.WriteAllText(Path.Combine(coreDirectory, "index.md"), "Hello World");

            Directory.CreateDirectory(Path.Combine(coreDirectory, "subdir"));

            // reference the bootstrapper (and turn on diagnostics)
            ServerConfig serverConfig = new ServerConfig(
                new List <Tuple <WikiConfig, IPageCache> >()
            {
                new Tuple <WikiConfig, IPageCache>(
                    new WikiConfig()
                {
                    SiteName       = "Tester",
                    RootSourcePath = PathHelper.GetFullPath(coreDirectory),
                    RootWikiPath   = PathHelper.GetFullPath(coreDirectory, "wiki"),
                    Convertor      = new Convertor(new MarkdownSharpDialogue())
                },
                    new PageCache()
                    )
            });

            // add filters
            foreach (var config in serverConfig.AllConfig)
            {
                config.Convertor.PostConvertors.Add(new MarkdownLinkPostFilter());
            }

            // basic startup pattern taken from:
            // https://github.com/loudej/owin-samples/blob/master/src/ConsoleNancySignalR/Program.cs
            // TODO: All this Gate/Owin stuff seems to be up in the air so this code needs reviewing
            // at some point

            startup = new ServerStartup(serverConfig, true, "password"); // this program's Startup.cs class

            startup.Start();

            Thread.Sleep(100);

            // add another page
            File.WriteAllText(Path.Combine(coreDirectory, "firstFile.md"), "Hello Again");

            // and another
            File.WriteAllText(Path.Combine(coreDirectory, "subdir", "index.md"), "Hello World Sub Directory");

            // then delete one
            File.Delete(Path.Combine(coreDirectory, "index.md"));
        }
Exemplo n.º 2
0
        static void StartUp(string[] args)
        {
            Thread.CurrentThread.Name = "Main";

            string coreDirectory = "D:\\ickletest";

            File.WriteAllText(Path.Combine(coreDirectory, "index.md"), "Hello World");

            Directory.CreateDirectory(Path.Combine(coreDirectory, "subdir"));

            // reference the bootstrapper (and turn on diagnostics)
            ServerConfig serverConfig = new ServerConfig(
                new List<Tuple<WikiConfig, IPageCache>>()
                {
                    new Tuple<WikiConfig, IPageCache>(
                        new WikiConfig()
                        {
                            SiteName = "Tester",
                            RootSourcePath = PathHelper.GetFullPath(coreDirectory),
                            RootWikiPath = PathHelper.GetFullPath(coreDirectory, "wiki"),
                            Convertor = new Convertor(new MarkdownSharpDialogue())
                        },
                        new PageCache()
                    )
                });

            // add filters
            foreach (var config in serverConfig.AllConfig)
            {
                config.Convertor.PostConvertors.Add(new MarkdownLinkPostFilter());
            }

            // basic startup pattern taken from:
            // https://github.com/loudej/owin-samples/blob/master/src/ConsoleNancySignalR/Program.cs
            // TODO: All this Gate/Owin stuff seems to be up in the air so this code needs reviewing
            // at some point

            startup = new ServerStartup(serverConfig, true, "password"); // this program's Startup.cs class

            startup.Start();

            Thread.Sleep(100);

            // add another page
            File.WriteAllText(Path.Combine(coreDirectory, "firstFile.md"), "Hello Again");

            // and another
            File.WriteAllText(Path.Combine(coreDirectory, "subdir", "index.md"), "Hello World Sub Directory");

            // then delete one
            File.Delete(Path.Combine(coreDirectory, "index.md"));
        }