static void Main(string[] args)
        {
            ConsoleInterface app = new ConsoleInterface();

            app.MenuInit();
            // DataAccessDemo.Test ();
        }
Example #2
0
        /// <summary>
        /// Print the hiding sub header
        /// </summary>
        internal static void PrintSubHeader(string type)
        {
            //Console.BackgroundColor = ConsoleColor.Black;
            //Console.ForegroundColor = ConsoleColor.Gray;

            ConsoleInterface.WriteUnderscoreLine(ConsoleColor.Gray);
            switch (type)
            {
            case "hiding":
                ConsoleInterface.Write(
                    "#####                                   " +
                    "-- Hiding a file --" +
                    "                                    #####",
                    ConsoleColor.Gray, true);
                break;

            case "extracting":
                ConsoleInterface.Write(
                    "#####                                 " +
                    "-- Extract a message --" +
                    "                                  #####",
                    ConsoleColor.Gray, true);
                break;

            default:
                break;
            }
            ConsoleInterface.WriteSharpLine(ConsoleColor.Gray);
            ConsoleInterface.WriteEmptyLine();
        }
Example #3
0
        public PlayerFactoryShould()
        {
            var randomNumberGenerator = new RandomGenerator();
            var userInterface         = new ConsoleInterface();

            _playerFactory = new PlayerFactory(randomNumberGenerator, userInterface);
        }
Example #4
0
        public static void trenchDialog1(Whale Player)
        {
            Enemies enemy = Enemies.EnemyGenerator();

            Console.Clear();
            ConsoleInterface.HUD(Player);
            Typewrite("\nYou exit your ship", "dialog");
            Fastwrite("\nI've been waiting for you ", "enemy");
            Typewrite($"{Player.Name}.", "self");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Typewrite("\nLundphin", "enemy");
            Fastwrite("It's over! I'm here to stop you once and for all!", "self");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Fastwrite("\nIn your dreams ", "enemy");
            Typewrite($"{Player.Name}!", "self");
            Fastwrite("\nIt is I who will be stopping you!", "enemy");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);

            enemy = new Enemies("Dolf Lundfin", CharClass.fighter, 40, 5, 9, 10);

            Combat.EndBattle(Player, enemy);
        }
        public void TestGetUserInputToReturnCorrectValue()
        {
            var mockedReader = new Mock <HelperReader>();

            Console.SetIn(mockedReader.Object);

            IList <string> input = new List <string>()
            {
                "DOWNARROW", "UPARROW", "LEFTARROW", "RIGHTARROW"
            };

            int indexOfCommand = 0;

            mockedReader.Setup(r => r.ReadLine()).Returns(() => input[indexOfCommand]);

            IUserInterface userInterface = new ConsoleInterface();
            string         result;

            for (; indexOfCommand < input.Count; indexOfCommand++)
            {
                result = userInterface.GetUserInput();
                Assert.AreEqual(input[indexOfCommand], result);
            }

            mockedReader.Verify(r => r.ReadLine(), Times.Exactly(input.Count));
        }
Example #6
0
        /// <summary>
        /// Renders on console screen the potential match on the line
        /// </summary>
        /// <param name="currentInput">The current prefix value - minus the actual command. This is the thing we'll be searching for.</param>
        /// <param name="commandPrefix">The type of command we are processing</param>
        /// <param name="potentialValues">A list of poential values we want to try to match to</param>
        private static void HandleTabAutoComplete(string currentInput, string commandPrefix, List <string> potentialValues)
        {
            string outputItem = string.Empty;
            var    matches    = potentialValues.Where(item => item != currentInput && item.StartsWith(currentInput, true, CultureInfo.InvariantCulture));

            if (matches.Count() == 0)
            {
                return;
            }

            _tabCount++;

            if (_tabCount <= matches.Count())
            {
                outputItem = matches.ToList()[_tabCount - 1];
            }
            else if (_tabCount > matches.Count())
            {
                _tabCount -= matches.Count();
                outputItem = matches.ToList()[_tabCount - 1];
            }

            ConsoleInterface.ClearCurrentLine();
            ConsoleInterface.ShowPrefix();
            string line = commandPrefix + " " + outputItem;

            ConsoleInterface.Builder.Clear();
            ConsoleInterface.Builder.Append(line);
            Console.Write(ConsoleInterface.Builder.ToString());
        }
Example #7
0
        static void Main()
        {
            if (doConsole)
            {
                AllocConsole(); // needs to be the first call in the program to prevent weird bugs
            }
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ClientSocket socket = new ClientSocket();

            string hostPath = "host.txt";

            //TODO make proper properties file
            string host = File.Exists(hostPath) ? File.ReadAllText(hostPath) : "http://localhost:8123";
            var    form = new UserForm(socket);

            conInterface = new FormConsole(form);                               //Create the Form Console interface.
            Task.Factory.StartNew(() => socket.Connect(host));                  //synchronously force the socket to connect
            Task.Factory.StartNew(() => GameMemReader.getInstance().RunLoop()); // run loop in background
            //(new DebugConsole(debugGui)).Run();

            Application.Run(form);
            //test
        }
Example #8
0
        internal static void HandleKeyUp()
        {
            _keyUpCount++;
            _enteredCommands.Reverse();

            string line = string.Empty;

            if (_keyUpCount <= _enteredCommands.Count())
            {
                line = _enteredCommands[_keyUpCount - 1];
            }
            else if (_keyUpCount > _enteredCommands.Count)
            {
                _keyUpCount -= _enteredCommands.Count();
                line         = _enteredCommands[_keyUpCount - 1];
            }

            ConsoleInterface.ClearCurrentLine();
            ConsoleInterface.ShowPrefix();
            ConsoleInterface.Builder.Clear();
            ConsoleInterface.Builder.Append(line);
            Console.Write(ConsoleInterface.Builder.ToString());

            _enteredCommands.Reverse();
        }
Example #9
0
        public static void BlubbernotDialog(Whale Player)
        {
            Player.currentPlanet = Blubbernot;
            Enemies enemy = Enemies.EnemyGenerator();

            Console.Clear();
            ConsoleInterface.HUD(Player);
            Typewrite("\nYour ship lands on ", "dialog");
            Typewrite("Blubbernot-6.", "location");
            Typewrite("\nNO MORE MESSING AROUND", "self");
            Fastwrite(" LUNDPHIN,", "enemy");
            Typewrite(" I'M FINISHING YOU THIS TIME!", "self");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Typewrite("\nYou exit your ship and immediately charge into the city ", "dialog");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Fastwrite("\nLundfin!", "enemy");
            Typewrite(" come out here and face me like a man!", "self");
            Typewrite("\nYou here a dolphin cackle.", "dialog");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Typewrite("\nPeople of ", "enemy");
            Typewrite("Blubbernot-6!", "location");
            Typewrite("Your \"hero\" has arrived!", "enemy");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Typewrite("\nYou see ", "dialog");
            Fastwrite("Dolph Lunphin", "enemy");
            Typewrite(" float down from the top of a building on his hover board.", "dialog");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Typewrite("\nI'd love to stick around and chat but I've got one last", "enemy");
            Fastwrite(" Henchmen", "yellow");
            Typewrite(" to do that for me.", "enemy");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Typewrite("It was nice knowing you, ", "enemy");
            Typewrite($"{Player.Name}!", "self");
            Fastwrite($"\n{enemy.Name}, ", "yellow");
            Fastwrite("FINISH HIM ONCE AND FOR ALL!", "enemy");
            Console.WriteLine("\nPress Space to continue.");
            Console.ReadKey();
            Console.Clear();
            ConsoleInterface.HUD(Player);
            Combat.Battle(Player, enemy);
        }
Example #10
0
        // [TestMethod]
        public async Task RunShouldTriggerExtractWorkflowWithConfiguration()
        {
            var cui = new ConsoleInterface();

            var result = await cui.RunAsync();

            Assert.AreEqual(0, result);
        }
Example #11
0
    /// <summary>
    /// This is the main method of the application. Here we create the User interface and the game engine objects
    /// After that the game engine is initialized and launched
    /// </summary>
    private static void Main()
    {
        IUserInterface consoleInterface = new ConsoleInterface();
        Engine gameEngine = new Engine(consoleInterface);

        gameEngine.InitializeEngine();
        gameEngine.Run();
    }
Example #12
0
    /// <summary>
    /// This is the main method of the application. Here we create the User interface and the game engine objects
    /// After that the game engine is initialized and launched
    /// </summary>
    private static void Main()
    {
        IUserInterface consoleInterface = new ConsoleInterface();
        Engine         gameEngine       = new Engine(consoleInterface);

        gameEngine.InitializeEngine();
        gameEngine.Run();
    }
Example #13
0
        public static void Main()
        {
            IGameDatabase gameDatabase = new GameDatabase();
            IIOInterface  io           = new ConsoleInterface();

            IEngine engine = new Engine(gameDatabase, io);

            engine.Run();
        }
Example #14
0
        public static string PlayerName()
        {
            Console.Clear();
            Typewrite("\nWhat is thy name?", "self");
            Fastwrite("\nType in your name: ", "dialog\n");
            string name = ConsoleInterface.Input();

            return(name);
        }
Example #15
0
        public static void Main(string[] args)
        {
            var randomGenerator  = new RandomGenerator();
            var consoleInterface = new ConsoleInterface();

            var game = GameFactory.Create(args, randomGenerator, consoleInterface);

            game.Play();
        }
 public static void Main()
 {
     ICommandManager commandManager = new CommandManager();
     IUserInterface userInterface = new ConsoleInterface();
     IRequester requester = new Requester();
    
     var engine = new GameEngine(userInterface, commandManager, requester);
     engine.Run();
 }
Example #17
0
        static async Task Main(string[] args)
        {
            // Setup everything we need to run the application.
            var comparerOptions = await BuildComparisonOptions(args);

            var statusFactory = new ExecutionStatusFactory();
            var mainLoop      = BuildMainLoop(statusFactory);

            // Print the intro splash.
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(ConsoleInterface.GetOpeningSplash());

            // Run the main application loop.
            do
            {
                var executionStatus = statusFactory.ConstructNoOp();
                try
                {
                    executionStatus = await mainLoop.Execute(comparerOptions);
                }
                catch (Exception exception)
                {
                    exception.WriteToConsole();
                }

                if (executionStatus.IsTerminated)
                {
                    break;
                }

                if (executionStatus.IsFaulted)
                {
                    if (executionStatus.FaultedReason.IsSome)
                    {
                        executionStatus.FaultedReason.Value.WriteToConsole();
                    }
                    else
                    {
                        Console.WriteLine("Unknown exception encountered.");
                    }

                    continue;
                }

                if (!executionStatus.IsFaulted)
                {
                    executionStatus.PrintingInstructions();
                }

                // Force the garbage collector to run, after each search session.
                // The idea being that collector will clean up any outstanding
                // resources from the run.
                GC.Collect();
            } while (true);

            Console.WriteLine("Exiting...");
        }
Example #18
0
        static void Main(string[] args)
        {
            var tillContext = new TillContext();
            var tillBL      = new TillBL(tillContext);

            var consoleInterface = new ConsoleInterface(tillContext, tillBL);

            consoleInterface.Run();
        }
        private static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            ICommandExecutor commandExecutor = new CommandExecuter();
            IUserInterface userInterface = new ConsoleInterface();

            var engine = new Engine(commandExecutor, userInterface);
            engine.Run();
        }
        public static void Main()
        {
            ICommandManager commandManager = new CommandManager();
            IUserInterface  userInterface  = new ConsoleInterface();
            IRequester      requester      = new Requester();

            var engine = new GameEngine(userInterface, commandManager, requester);

            engine.Run();
        }
Example #21
0
        static void Main(string[] args)
        {
            var availablePlugins = PluginsService.Instance.GetAvailablePluginsTypes();

            _ = new ServiceManager();
            var consoleInterface = new ConsoleInterface(availablePlugins, ServiceManager.GetLogger());

            consoleInterface.DisplayStartScreen();
            consoleInterface.ChooseMode();
        }
Example #22
0
        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            var userInterface = new ConsoleInterface();
            var commandExecutor = new CommandExecutor(userInterface);
            var data = new BattleshipsData();
            var engine = new BattleshipsEngine(commandExecutor, userInterface, data);
            engine.Run();
        }
Example #23
0
        public static int ShieldSlam(Whale Player, Enemies target)
        {
            Console.Clear();
            ConsoleInterface.HUD(Player);

            target.Health -= (Player.Defense - target.Defense);
            Console.WriteLine($"You bash your weapon against {target.Name}, dealing {Player.Defense - target.Defense} damage");

            return(target.Health);
        }
Example #24
0
        public static void Main()
        {
            NetCoreAudio.Player WWTheme = new NetCoreAudio.Player();
            WWTheme.Play("WW_Background.wav");



            Management.Title();

            Game.startGame();

            string name = Game.PlayerName();

            Whale Player = Game.nameCharacter(name);

            Game.Choice(Player);

            Game.preBlowholiaDialog(Player);

            Game.BlowholiaDialog(Player);

            Game.postBlowholiaDialog(Player);

            ConsoleInterface.Goose1(Player);

            ConsoleInterface.Shop1(Player);

            ConsoleInterface.Ship1(Player);

            Game.AtlantisDialog(Player);

            Game.postAtlantisDialog(Player);

            ConsoleInterface.Ship2(Player);

            Game.CoraltonDialog(Player);

            Game.postCoraltonDialog(Player);

            ConsoleInterface.Ship3(Player);

            Game.BlubbernotDialog(Player);

            Game.postBlubbernotDialog(Player);

            ConsoleInterface.Ship4(Player);

            Game.trenchDialog(Player);

            Game.PreTrenchChoice(Player);

            Game.trenchDialog1(Player);

            Game.posttrenchDialog(Player);
        }
Example #25
0
        public static void Main(string[] args)
        {
            ConsoleOutputRouter router     = new ConsoleOutputRouter();
            ConsoleInterface    @interface = new ConsoleInterface();

            router.AddListener(@interface, RouterOptions.ReceivesAll, new string[0]);
            router.AddListener(new FileInterface("C:\\users\\kryxzael\\desktop\\out.txt", true), RouterOptions.ReceivesAll, new string[0]);
            while (true)
            {
                @interface.ReadLine(router);
            }
        }
Example #26
0
        public static int Berserk(Whale Player, Enemies target)
        {
            Console.Clear();
            ConsoleInterface.HUD(Player);

            target.Health -= (Player.Offense + 5);
            Player.Health -= 2;

            Console.WriteLine($"You charge {target.Name}, sacraficing 5 health to do {Player.Offense + 5} damage ");

            return(target.Health);
        }
Example #27
0
 public static void Main()
 {
     // TODO: Add instance of the GameRenderingEngine and call that instance when creating the game engine
     var brightSkin = new BrightSkin();
     IOInterface userInterractor = new ConsoleInterface(brightSkin);
     Scoreboard scoreboard = Scoreboard.GetInstance;
     scoreboard.SetIOInterface(userInterractor);
     GameBoard gameBoard = GameBoard.GetInstance;
     CommandProcessor commandProcessor = new CommandProcessor(gameBoard, scoreboard, userInterractor, new CommandParser());
     GameEngine engine = new GameEngine(commandProcessor, userInterractor, gameBoard);
     engine.Play();
 }
Example #28
0
        public static int BasicAtk(Whale Player, Enemies target)
        {
            Console.Clear();
            ConsoleInterface.HUD(Player);

            int pd = Player.Offense - target.Defense;

            target.Health -= (Player.Offense - target.Defense);
            Console.WriteLine($"You hastely attack with your {Player.EquipedWeapon[0].Name} dealing {pd} to {target.Name}");

            return(target.Health);
        }
Example #29
0
        /// <summary>
        /// Print the header
        /// </summary>
        internal static void PrintHeader()
        {
            //Console.BackgroundColor = ConsoleColor.Black;
            //Console.ForegroundColor = ConsoleColor.DarkYellow;

            ConsoleInterface.Write("____________________________________________________________________________________________________", ConsoleColor.DarkYellow, true);
            ConsoleInterface.Write("#####                                     --- LsbStego ---                                    ######", ConsoleColor.DarkYellow, true);
            ConsoleInterface.Write("#####         Hiding arbitrary files securely by choosing well suitable carrier images        ######", ConsoleColor.DarkYellow, true);
            ConsoleInterface.Write("#####                         based on the amount of necessary LSB changes                    ######", ConsoleColor.DarkYellow, true);
            ConsoleInterface.Write("####################################################################################################", ConsoleColor.DarkYellow, true);

            ConsoleInterface.WriteEmptyLine();
        }
        public static void Main(string[] args)
        {
            string path = System.AppDomain.CurrentDomain.BaseDirectory;

            Console.WriteLine(path);
            string newPath = Path.GetFullPath(Path.Combine(path, @"..\..\..\"));

            Console.WriteLine(newPath);

            ConsoleInterface inter = new ConsoleInterface();

            inter.Start();
        }
Example #31
0
        public static int Lung(Whale Player, Enemies target)
        {
            Console.Clear();
            ConsoleInterface.HUD(Player);

            int pd = (Player.Offense - target.Defense) + 1;

            target.Health -= (Player.Offense - target.Defense) + 1;

            Console.WriteLine($"You thrust your {Player.EquipedWeapon[0].Name} dealing {pd} to {target.Name}");

            return(target.Health);
        }
Example #32
0
        public static int SpawnMinion(Whale Player, Enemies target)
        {
            Console.Clear();
            ConsoleInterface.HUD(Player);

            Enemies target2 = EnemyGenerator();

            Console.WriteLine($"{target.Name} Yells: I NEED HELP! {target2.Name} rushes you from out of the shadows.");

            Thread.Sleep(2000);

            Combat.Battle(Player, target, target2);
            return(0);
        } //boss move used to add another monster into combat. 3 person Combat WOOO!
Example #33
0
        internal static void HandleEnter()
        {
            Console.WriteLine();
            if (App.Mode == AppMode.PendingConnection && ConsoleInterface.Builder.ToString() != "?")
            {
                App.Connect(ConsoleInterface.Builder.ToString());
            }
            else
            {
                App.ParseCommand(ConsoleInterface.Builder.ToString());
            }

            ConsoleInterface.ShowPrefix();
        }
Example #34
0
        internal GameUI(GameUserInterface parent, List <ISettingsProvider> settingsProviders,
                        IConsoleProvider consoleProvider, IPlayerDataProvider playerDataProvider,
                        IPerformanceProvider performanceProvider) : base(parent.Root)
        {
            this.parent              = parent;
            this.settingsProviders   = settingsProviders;
            this.playerDataProvider  = playerDataProvider;
            this.performanceProvider = performanceProvider;

            Console = new ConsoleInterface(this, consoleProvider, parent.Context);
            hud     = new InGameDisplay(this);

            Console.WindowClosed += parent.DoOverlayClose;
        }
Example #35
0
        static void Main(string[] args)
        {
            ConsoleInterface app = new ConsoleInterface();

            app.MenuInit();

            // DataAccessDemo.Test ();
            // DataAccessDemo.TestEFC ();
            // DataAccessDemo.TestEFC ();
            // DataAccessDemo.TestCount ();

            // TestAttributeByAtributeName ();

            // TestStringToDateTime ();
        }
Example #36
0
        public void TestHelpRequestEvent()
        {
            bool isTriggered = false;
            IUserInterface consoleInterface = new ConsoleInterface();
            consoleInterface.HelpRequest += (sender, eventInfo) =>
            {
                isTriggered = true;
            };

            Word currentWord = new Word("test");
            WordData currentWordDate = new WordData(currentWord);

            string inputString = string.Format("help{0}", Environment.NewLine);
            using (StringReader sr = new StringReader(inputString))
            {
                Console.SetIn(sr);

                consoleInterface.GetUserInput(currentWordDate);
            }

            Assert.IsTrue(isTriggered);
        }