Esempio n. 1
0
        static async Task Main(string[] args)
        {
            using var log = new LoggerConfiguration()
                            .WriteTo.File("log.txt")
                            .AddMsSqlServerSink("Server=(localDB)\\MSSQLLocalDB;Initial Catalog=DumpLibrary;Integrated Security=True;")
                            .CreateLogger();

            log.Information($"Application Started {Environment.UserName}");

            try
            {
                var consoleEngine = new ConsoleEngine(log);
                var dbCtx         = new SampleDesignTimeDbContextFactory().CreateDbContext(args);
                var unitOfWork    = new UnitOfWork(dbCtx);
                var authorService = new AuthorService(unitOfWork);
                var bookService   = new BookService(unitOfWork);
                var controller    = new DumpLibraryController(consoleEngine, authorService, bookService);

                await controller.DisplayAllAuthors();

                await controller.RunBookLoop();
            }
            catch (Exception ex)
            {
                log.Error(ex, "App error!");
            }

            log.Information("Application Ended");
        }
Esempio n. 2
0
        public static string SettingsPath()
        {
            string appName  = ConsoleEngine.GetAppInfo().ProductName.Replace(" ", string.Empty);
            string settings = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), appName);

            if (!Directory.Exists(settings))
            {
                try
                {
                    DirectoryInfo info = Directory.CreateDirectory(settings);
                }
                catch (IOException ex)
                {
                    return(string.Empty);
                }
                catch (UnauthorizedAccessException ex)
                {
                    return(string.Empty);
                }
                catch (ArgumentException ex)
                {
                    return(string.Empty);
                }
                catch (NotSupportedException ex)
                {
                    return(string.Empty);
                }
            }

            return(string.Concat(settings, "\\", appName, ".json"));
        }
Esempio n. 3
0
        static async Task Main(string[] args)
        {
            using var log = new LoggerConfiguration()
                            .WriteTo.File("log.txt")
                            .AddMsSqlServerSink("Server=(localDB)\\MSSQLLocalDB;Initial Catalog=DumpLibrary;Integrated Security=True;")
                            .CreateLogger();

            log.Information($"Application Started {Environment.UserName}");

            try
            {
                var dbCtx         = new SampleDesignTimeDbContextFactory().CreateDbContext(args);
                var dbService     = new DbService(dbCtx);
                var consoleEngine = new ConsoleEngine(log);

                var authors = await dbService.GetAllAuthors();

                consoleEngine.Display(authors);

                ConsoleActions optionCode = ConsoleActions.Exit;
                do
                {
                    optionCode = consoleEngine.ShowMenuAndGetOption();

                    switch (optionCode)
                    {
                    case ConsoleActions.List:
                        var books = await dbService.GetBooksWithAuthors();

                        consoleEngine.DisplayBooks(books);
                        break;

                    case ConsoleActions.Insert:
                        var book = consoleEngine.GetBook();
                        await dbService.Insert(book);

                        break;

                    case ConsoleActions.Update:
                        var bookForUpdate = consoleEngine.GetBookForUpdateTitle();
                        await dbService.UpdateBookTitle(bookForUpdate.Id, bookForUpdate.Title);

                        break;

                    case ConsoleActions.Delete:
                        var deleteBookId = consoleEngine.GetBookForDelete();
                        await dbService.Delete(deleteBookId);

                        break;
                    }
                }while (optionCode != ConsoleActions.Exit);
            }
            catch (Exception ex)
            {
                log.Error(ex, "App error!");
            }

            log.Information("Application Ended");
        }
Esempio n. 4
0
 public BeatSymbol(ConsoleEngine renderer, double startPos, double endPos, double speed)
 {
     this._renderer  = renderer;
     this.startPos   = startPos;
     this.endPos     = endPos;
     this.speed      = speed;
     this.currentPos = this.startPos;
     this.posStep    = speed;
 }
Esempio n. 5
0
        static void Main(string[] args)
        {
            ConsoleEngine engine = new ConsoleEngine();

            engine.Launch();

            //WorldCreator creator = new WorldCreator();
            //creator.ShowMainMenu();
        }
Esempio n. 6
0
 public void Draw(ConsoleEngine engine)
 {
     for (int y = 0; y < Height; y++)
     {
         for (int x = 0; x < Width; x++)
         {
             engine.SetPixel(new Point(x, y), 15, ConsoleCharacter.Full);
         }
     }
 }
Esempio n. 7
0
        public void Initialize(ConsoleEngine engine, ModelRenderer modelRenderer, SpriteRenderer spriteRenderer, AnimationRenderer animationRenderer)
        {
            foreach (var item in levels)
            {
                item.Engine            = engine;
                item.ModelRenderer     = modelRenderer;
                item.SpriteRenderer    = spriteRenderer;
                item.AnimationRenderer = animationRenderer;

                item.LevelManager = this;

                item.Create();
            }
        }
Esempio n. 8
0
        private static void Main(string[] args)
        {
            var consoleScreenWidth  = 300;
            var consoleScreenHeight = 120;

            //MessageBox.Show("Top row digits 1-8 switches models.\n\nUp & Down & Left & Right translation.\n[ & ] scale.\n\DefaultColors & K & L & O & P rotate.");

            var screen        = new Kernel32ConsoleWindow(consoleScreenWidth, consoleScreenHeight, "Graphics Engine Test", 0x0000);
            var renderer      = new Renderer(screen);
            var meshTestScene = new MeshTestScene(consoleScreenWidth, consoleScreenHeight);
            var engine        = new ConsoleEngine(renderer, meshTestScene);

            engine.Start();

            Console.ReadLine();
        }
Esempio n. 9
0
        public static async Task Main(string[] args)
        {
            var services = new ServiceCollection();

            services.AddSingleton <IService, MyService>();

            var resolver = new Resolver(services);

            var rootCommand = new RootCommand();

            rootCommand.Register <SessionsContainer>();

            var engine = new ConsoleEngine(rootCommand, resolver);

            await engine.RunAsync();
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            String com = "COM4";

            if (args.Length == 1)
            {
                com = args[0];
            }

            settings_data = new byte[] {
                0x00,       // trigger bitbang mode
                0b00000010, // i2c mode
                0b00001111  // i2c sniffer
            };

            pixel_x = 0;
            pixel_y = 0;

            Console.SetWindowSize(128, 64);
            Engine        = new ConsoleEngine(128, 64, 8, 8);
            Console.Title = "RetroLCD.com I2CU Pirate View";

            //SetBaudSpeed(com);

            if (!GoIntoSpyMode(com))
            {
                return;
            }

            Console.WriteLine("Reading Data...");

            bool done = false;

            while (!done)
            {
                ReadCom(port);
                ProcessBuffer();
            }
            port.Close();
        }
        public static void Main(string[] args)
        {
            var consoleEngine = new ConsoleEngine(60, 45, 8, 8);

            while (true)
            {
                consoleEngine.WriteText(new Point(05, 0), "New", 3, 4);
                consoleEngine.Sector(new Point(05, 5), 4, 180, 270, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(15, 5), 4, 360, 0, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(25, 5), 4, 0, 360, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(35, 5), 4, 270, 90, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(45, 5), 4, -90, 135, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(55, 5), 4, 90, 270, 4, 13, ConsoleCharacter.Full);

                consoleEngine.WriteText(new Point(05, 10), "Old", 3, 4);
                consoleEngine.SemiCircle(new Point(05, 15), 4, 180, 270, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(15, 15), 4, 360, 0, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(25, 15), 4, 0, 360, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(35, 15), 4, 270, 90, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(45, 15), 4, -90, 135, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(55, 15), 4, 90, 270, 4, 13, ConsoleCharacter.Full);


                consoleEngine.WriteText(new Point(05, 20), "New", 3, 4);
                consoleEngine.Arc2(new Point(05, 25), 4, 180, 270, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Arc2(new Point(15, 25), 4, 360, 0, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Arc2(new Point(25, 25), 4, 0, 360, 4, 13, ConsoleCharacter.Full);

                consoleEngine.WriteText(new Point(05, 30), "Old", 3, 4);
                consoleEngine.Arc(new Point(05, 35), 4, 4, 13, 270, ConsoleCharacter.Full);
                consoleEngine.Arc(new Point(15, 35), 4, 4, 13, 0, ConsoleCharacter.Full);
                consoleEngine.Arc(new Point(25, 35), 4, 4, 13, 360, ConsoleCharacter.Full);

                consoleEngine.Circle(new Point(45, 25), 4, 4, 13, ConsoleCharacter.Full);

                consoleEngine.DisplayBuffer();
            }
        }
Esempio n. 12
0
 public static void setEngine(ConsoleEngine e)
 {
     engine = e;
 }
 public DumpLibraryController(ConsoleEngine consoleEngine, AuthorService authorService, BookService bookService)
 {
     this.consoleEngine = consoleEngine;
     this.authorService = authorService;
     this.bookService   = bookService;
 }
Esempio n. 14
0
 public override void OnRender(ConsoleEngine engine)
 {
 }
Esempio n. 15
0
 public override void OnRender(ConsoleEngine engine)
 {
     _titleFireLeft.Render(engine);
     _titleFireRight.Render(engine);
 }
Esempio n. 16
0
        public void EngineIstanceOfIEngineTest()
        {
            ConsoleEngine engineInstance = ConsoleEngine.Instance;

            Assert.IsTrue(engineInstance is IEngine);
        }
Esempio n. 17
0
 public void Render(ConsoleEngine console)
 {
     Frames[_animationIndex].Render(console);
 }
Esempio n. 18
0
        public static void Main()
        {
            ConsoleEngine consoleEngine = new ConsoleEngine();

            consoleEngine.Run();
        }
Esempio n. 19
0
 public void Render(ConsoleEngine engine)
 {
     VisibleFrame.Render(engine);
     OnRender(engine);
 }
Esempio n. 20
0
 public abstract void OnRender(ConsoleEngine engine);