示例#1
0
        public void FetchAssemblyList(string directoryPath)
        {
            ConsoleLogger consoleLogger = new ConsoleLogger(true);

            DirectoryInfo directoryInfo = new DirectoryInfo(directoryPath);

            if (!Directory.Exists(directoryPath))
            {
                consoleLogger.LogMessage(string.Format("Directory: '{0}' does not exist.", directoryPath));
                throw new ArgumentException("Cannot process files in directory: " + directoryPath);
            }

            // For each directory inside the directoryPath, analyze its dependencies
            IEnumerable <string> extensionDirs = Directory.EnumerateDirectories(directoryPath);

            foreach (string extensionDir in extensionDirs)
            {
                IDependencyAnalyzer analyzer = new DependencyAnalyzer()
                {
                    DirectoryInfo = new DirectoryInfo(extensionDir)
                };
                DependencyAnalyzerResult result = analyzer.Analyze(consoleLogger);

                // Output results to Console
                IDependencyVisualizer visualizer = new ConsoleVisualizer(result);
                visualizer.Visualize();

                // Export results to file
                IDependencyVisualizer export = new DgmlExport(result, Path.Combine(directoryPath, extensionDir + ".references.dgml"), consoleLogger);
                export.Visualize();
            }

            Console.Out.WriteLine("Finished fetching assemblies");
        }
示例#2
0
 private static void OnFlavourText(object sender, FlavourTextEventArgs e)
 {
     if (e.name.Contains(flagship.Name) || e.level <= FlavourTextEventArgs.LEVEL_INFO)
     {
         output.WriteLine(ConsoleVisualizer.GetTeamColor(e.team), "[" + e.name + "]: " + e.message);
     }
 }
        private void ProcessCommand(string[] command)
        {
            ConsoleVisualizer visualizer = new ConsoleVisualizer(field);
            
            if (command.Length == 1)
            {
                string gameCommand = command[0];

                switch (gameCommand)
                {
                    case "restart": Play();
                        break;
                    case "top": visualizer.VisualizeScore(this.Scores);
                        break;
                    case "exit": this.Exit();
                        break;
                    default: visualizer.VisualizeField();
                        break;
                }
            }
            else if (command.Length == 2)
            {
                int row = 0;
                int col = 0;
                bool tryParse = false;
                tryParse = (Int32.TryParse(command[0], out row) || tryParse);
                tryParse = (Int32.TryParse(command[1], out col) || tryParse);

                if (!tryParse)
                {
                    throw new CommandUnknownException();
                }

                if (field.RevealCell(row, col) == '*')
                {
                    field.MarkAndRevealEmptyFields('-');
                    field.RevealMines();
                    Console.WriteLine(field.ToString());
                    Console.WriteLine(String.Format("Booooom! You were killed by a mine. You revealed {0} cells without mines.", CurrentScore));
                    Console.Write("Please enter your name for the top scoreboard: ");
                    string playerName = Console.ReadLine();
                    Scores.Add(new Score(playerName, this.CurrentScore));
                    Console.WriteLine();
                    PrintScoreBoard();
                    //Play();
                }
                else
                {
                    visualizer.VisualizeField();
                    //Console.WriteLine(field.ToString());
                    this.CurrentScore++;
                    //ProcessCommand(command);
                }
                //TODO: Implement the missed logic
            }
            else
            {
                throw new CommandUnknownException("No exist such command!");
            }
        }
示例#4
0
        }  // End  setConsoleSize()

        public static void UpdateDisplay(IDamageableEntity target, IDamageableEntity flagship, List <IGameEntity> ships, IConsole scanPanel, IConsole statusPanel, IConsole radarPanel, IConsole shipListPanel)
        {
            if (target != null)
            {
                ConsoleVisualizer.PrintShip((Ship)target, scanPanel, ConsoleColor.White);
            }

            ConsoleVisualizer.PrintShip((Ship)flagship, statusPanel, ConsoleColor.White);
            ConsoleVisualizer.DrawRadar(radarPanel, ships, flagship, 2000);
            ConsoleVisualizer.DrawShipList(shipListPanel, ships, flagship);
        }
        public override void Play()
        {
            ConsoleVisualizer visualizer = new ConsoleVisualizer(field);
            base.Play();
            string startMessage = "Welcome to the game “Minesweeper”. Try to reveal all cells without mines. Use 'top' to view the scoreboard, 'restart' to start a new game and 'exit' to quit the game.";
            Console.WriteLine(startMessage);
            
            while (true)
            {
                visualizer.VisualizeField();

                Console.Write("Enter row and column:");
                string inputLine = Console.ReadLine().ToLower().Trim();
                string[] command = inputLine.Split(' ');

                ProcessCommand(command);
            }
        }
示例#6
0
        public static void BuildTestSchedule()
        {
            string      dateFormat    = "yyyyMMdd";
            int         channelID     = 1;
            string      status        = "In Planning";
            const int   secondsInHour = 3600;
            ScheduleDay day           = new ScheduleDay(IdGenerator.GetNextID(), channelID, DateTime.ParseExact("20200501", dateFormat, null), status);

            day.AddEvent(
                new ScheduleEvent(
                    IdGenerator.GetNextID(),
                    new TimeValue(secondsInHour * 6),
                    new TimeValue(secondsInHour * 2),
                    DateTime.ParseExact("20200501", dateFormat, null),
                    channelID,
                    "Morning Show"));
            day.AddEvent(
                new ScheduleEvent(
                    IdGenerator.GetNextID(),
                    new TimeValue(secondsInHour * 10),
                    new TimeValue(secondsInHour * 2),
                    DateTime.ParseExact("20200501", dateFormat, null),
                    channelID,
                    "Lazy Morning Show"));
            day.AddEvent(
                new ScheduleEvent(
                    IdGenerator.GetNextID(),
                    new TimeValue(secondsInHour * 8),
                    new TimeValue(secondsInHour * 2),
                    DateTime.ParseExact("20200501", dateFormat, null),
                    channelID,
                    "Normal People Morning Show"));
            foreach (ScheduleEvent e in day.Events)
            {
                e.AddSubElement(
                    new ScheduleElement[] {
                    new ProgramPart(IdGenerator.GetNextID(), TimeValue.Zero, new TimeValue(25 * 60)),
                    new ScheduleBreak(
                        IdGenerator.GetNextID(),
                        TimeValue.Zero,
                        new TimeValue(5 * 60),
                        subElements: new ScheduleAvail[] {
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Billboard, TimeValue.Zero, new TimeValue(20)),
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Commercial, TimeValue.Zero, new TimeValue(5 * 60 - 20))
                    }
                        ),
                    new ProgramPart(IdGenerator.GetNextID(), TimeValue.Zero, new TimeValue(25 * 60)),
                    new ScheduleBreak(
                        IdGenerator.GetNextID(),
                        TimeValue.Zero,
                        new TimeValue(5 * 60),
                        subElements: new ScheduleAvail[] {
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Billboard, TimeValue.Zero, new TimeValue(30)),
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Commercial, TimeValue.Zero, new TimeValue(5 * 60 - 30))
                    }
                        ),
                    new ProgramPart(IdGenerator.GetNextID(), TimeValue.Zero, new TimeValue(25 * 60)),
                    new ScheduleBreak(
                        IdGenerator.GetNextID(),
                        TimeValue.Zero,
                        new TimeValue(5 * 60),
                        subElements: new ScheduleAvail[] {
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Billboard, TimeValue.Zero, new TimeValue(30)),
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Commercial, TimeValue.Zero, new TimeValue(2 * 60 - 30)),
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Commercial, TimeValue.Zero, new TimeValue(3 * 60))
                    }
                        ),
                    new ProgramPart(IdGenerator.GetNextID(), TimeValue.Zero, new TimeValue(25 * 60)),
                    new ScheduleBreak(
                        IdGenerator.GetNextID(),
                        TimeValue.Zero,
                        new TimeValue(5 * 60),
                        subElements: new ScheduleAvail[] {
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Billboard, TimeValue.Zero, new TimeValue(30)),
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Commercial, TimeValue.Zero, new TimeValue(2 * 60 - 30)),
                        new ScheduleAvail(IdGenerator.GetNextID(), SchduleAvailType.Commercial, TimeValue.Zero, new TimeValue(3 * 60))
                    }
                        )
                }
                    );
            }



            ConsoleVisualizer.PrintDay(day);
        }