private void TryToRender(IOutputRenderer renderer, ChangeManifest result, string message)
 {
     try
     {
         ConsoleOutputWithColourToggle(message, ConsoleColor.White, Console.Write);
         var results = renderer.Render(result);
         if (!string.IsNullOrEmpty(results))
         {
             File.WriteAllText(_outputFilename ?? "Output.html", results);
             ConsoleOutputWithColourToggle("success! Please refresh browser.", ConsoleColor.Green, Console.Write);
         }
         else
         {
             ConsoleOutputWithColourToggle("failed.  Nothing written...", ConsoleColor.Red, Console.Write);
         }
         Console.WriteLine();
     }
     catch (Exception ex)
     {
         Console.Clear();
         ConsoleOutputWithColourToggle(String.Format("{0} - Failed to render template, fix it, save it and I will try again...", DateTime.Now), ConsoleColor.Red, Console.WriteLine);
         Console.WriteLine();
         ConsoleOutputWithColourToggle(ex.ToString(), ConsoleColor.Yellow, Console.WriteLine);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RedwoodPresenter"/> class.
 /// </summary>
 public RedwoodPresenter()
 {
     MarkupFileLoader = new DefaultMarkupFileLoader();
     PageBuilder = new DefaultPageBuilder();
     ViewModelLoader = new DefaultViewModelLoader();
     ViewModelSerializer = new DefaultViewModelSerializer();
     OutputRenderer = new DefaultOutputRenderer();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotvvmPresenter" /> class.
 /// </summary>
 public DotvvmPresenter(DotvvmConfiguration configuration, IDotvvmViewBuilder viewBuilder, IViewModelLoader viewModelLoader, IViewModelSerializer viewModelSerializer,
                        IOutputRenderer outputRender, ICsrfProtector csrfProtector)
 {
     DotvvmViewBuilder   = viewBuilder;
     ViewModelLoader     = viewModelLoader;
     ViewModelSerializer = viewModelSerializer;
     OutputRenderer      = outputRender;
     CsrfProtector       = csrfProtector;
     ApplicationPath     = configuration.ApplicationPhysicalPath;
 }
 public Engine(
     IInputHandler reader,
     IOutputRenderer writer, 
     IGameData gameData, 
     ICommandManager commandManager)
 {
     this.Reader = reader;
     this.Writer = writer;
     this.GameData = gameData;
     this.CommandManager = commandManager;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotvvmPresenter"/> class.
 /// </summary>
 public DotvvmPresenter(
     IDotvvmViewBuilder dotvvmViewBuilder,
     IViewModelLoader viewModelLoader,
     IViewModelSerializer viewModelSerializer,
     IOutputRenderer outputRenderer,
     ICsrfProtector csrfProtector
     )
 {
     DotvvmViewBuilder   = dotvvmViewBuilder;
     ViewModelLoader     = viewModelLoader;
     ViewModelSerializer = viewModelSerializer;
     OutputRenderer      = outputRenderer;
     CsrfProtector       = csrfProtector;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotvvmPresenter"/> class.
 /// </summary>
 public DotvvmPresenter(
     IDotvvmViewBuilder dotvvmViewBuilder,
     IViewModelLoader viewModelLoader,
     IViewModelSerializer viewModelSerializer,
     IOutputRenderer outputRenderer,
     ICsrfProtector csrfProtector
 )
 {
     DotvvmViewBuilder = dotvvmViewBuilder;
     ViewModelLoader = viewModelLoader;
     ViewModelSerializer = viewModelSerializer;
     OutputRenderer = outputRenderer;
     CsrfProtector = csrfProtector;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RedwoodPresenter"/> class.
 /// </summary>
 public RedwoodPresenter(
     IRedwoodViewBuilder redwoodViewBuilder,
     IViewModelLoader viewModelLoader,
     IViewModelSerializer viewModelSerializer,
     IOutputRenderer outputRenderer,
     ICsrfProtector csrfProtector
 )
 {
     RedwoodViewBuilder = redwoodViewBuilder;
     ViewModelLoader = viewModelLoader;
     ViewModelSerializer = viewModelSerializer;
     OutputRenderer = outputRenderer;
     CsrfProtector = csrfProtector;
 }
Ejemplo n.º 8
0
        public DotvvmPresenter(DotvvmConfiguration configuration, IDotvvmViewBuilder viewBuilder, IViewModelLoader viewModelLoader, IViewModelSerializer viewModelSerializer,
                               IOutputRenderer outputRender, ICsrfProtector csrfProtector, IViewModelParameterBinder viewModelParameterBinder,
#pragma warning disable CS0618
                               IStaticCommandServiceLoader staticCommandServiceLoader
#pragma warning restore CS0618
                               )
        {
            DotvvmViewBuilder        = viewBuilder;
            ViewModelLoader          = viewModelLoader;
            ViewModelSerializer      = viewModelSerializer;
            OutputRenderer           = outputRender;
            CsrfProtector            = csrfProtector;
            ViewModelParameterBinder = viewModelParameterBinder;
#pragma warning disable CS0618
            StaticCommandServiceLoader = staticCommandServiceLoader;
#pragma warning restore CS0618
            ApplicationPath = configuration.ApplicationPhysicalPath;
        }
Ejemplo n.º 9
0
 public Board(IOutputRenderer output, IPlayer player)
 {
     _Output = output;
     _Player = player;
 }
Ejemplo n.º 10
0
 public DotvvmFileUploadMiddleware(IOutputRenderer outputRenderer, IUploadedFileStorage fileStorage)
 {
     this.outputRenderer = outputRenderer;
     this.fileStorage    = fileStorage;
 }
Ejemplo n.º 11
0
 public GameEngine(IOutputRenderer output, IBoard board, IPlayer player)
 {
     _Output = output;
     _Board  = board;
     _Player = player;
 }
 public StatusPagePresenter(DotvvmConfiguration configuration, IDotvvmViewBuilder viewBuilder, IViewModelLoader viewModelLoader,
                            IViewModelSerializer viewModelSerializer, IOutputRenderer outputRender, ICsrfProtector csrfProtector,
                            IViewModelParameterBinder viewModelParameterBinder, IStaticCommandServiceLoader staticCommandServiceLoader) :
     base(configuration, viewBuilder, new DefaultViewModelLoader(), viewModelSerializer, outputRender, csrfProtector, viewModelParameterBinder, staticCommandServiceLoader)
 {
 }
 private void TryToRender(IOutputRenderer renderer, ChangeManifest result, string message)
 {
     try
     {
         ConsoleOutputWithColourToggle(message, ConsoleColor.White, Console.Write);
         var results = renderer.Render(result);
         if (!string.IsNullOrEmpty(results))
         {
             File.WriteAllText(_outputFilename ?? "Output.html", results);
             ConsoleOutputWithColourToggle("success! Please refresh browser.", ConsoleColor.Green, Console.Write);
         }
         else
         {
             ConsoleOutputWithColourToggle("failed.  Nothing written...", ConsoleColor.Red, Console.Write);
         }
         Console.WriteLine();
     }
     catch (Exception ex)
     {
         Console.Clear();
         ConsoleOutputWithColourToggle(String.Format("{0} - Failed to render template, fix it, save it and I will try again...",DateTime.Now), ConsoleColor.Red, Console.WriteLine);
         Console.WriteLine();
         ConsoleOutputWithColourToggle(ex.ToString(), ConsoleColor.Yellow, Console.WriteLine);
     }
 }
Ejemplo n.º 14
0
 public MineraftApplication(IOutputRenderer output, IGameEngine gameEngine)
 {
     _Output     = output;
     _GameEngine = gameEngine;
 }