コード例 #1
0
 public static CombinedEnvironment RunWith(ProgramOptions options)
 {
     return(RunWith(options, Console.Out, Console.Error));
 }
コード例 #2
0
 public CombinedEnvironment(ProgramOptions options, TextWriter output, TextWriter error)
 {
     this.options = options;
     this.output  = output;
     this.error   = error;
 }
コード例 #3
0
        private static IEnumerable <IEnvironmentLifecycle> StartServerWithVirtualMappings(ProgramOptions options)
        {
            if (options.VirtualPathMappings.Count > 0)
            {
                var serverPrototype = EmbeddedServer.NewServer(options.Port);

                foreach (var mapping in options.VirtualPathMappings)
                {
                    Console.WriteLine("Adding {0} -> {1}", mapping.VirtualPath, mapping.PhysicalPath);
                    serverPrototype = serverPrototype.WithVirtualDirectory(mapping.VirtualPath, mapping.PhysicalPath);
                }

                var server = serverPrototype.Start();

                Console.WriteLine("Server listening at {0}", options.Port);

                return(new List <IEnvironmentLifecycle>()
                {
                    new EmbeddedServerLifecycle(server)
                });
            }

            return(new List <IEnvironmentLifecycle>());
        }