private string AddScore(string username, string password, string gamename, string gamePassword, int score)
        {
            if (!this.playersByUsername.ContainsKey(username) || this.playersByUsername[username] != password ||
                !this.gamesByGamename.ContainsKey(gamename) || this.gamesByGamename[gamename] != gamePassword)
            {
                return("Cannot add score");
            }
            var scoreBoard = new Scoreboard(score, username);

            if (!this.scores.ContainsKey(gamename))
            {
                this.scores.Add(gamename, new OrderedBag <Scoreboard>());
            }
            this.scores[gamename].Add(scoreBoard);
            return("Score added");
        }
Esempio n. 2
0
        static void Main()
        {
            Scoreboard scoreboard  = new Scoreboard();
            string     commandLine = Console.ReadLine();

            while (commandLine != "End")
            {
                string output = scoreboard.ProcessCommand(commandLine);

                if (output != "")
                {
                    Console.WriteLine(output);
                }

                commandLine = Console.ReadLine();
            }
        }
Esempio n. 3
0
        public ControlCenter()
        {
            try
            {
                InitializeComponent();
                imagepath       = getImagePath();
                playerimagepath = getPlayerImagePath();
                Screen[] screens = Screen.AllScreens;
                scb = new Scoreboard();
                if (screens.Length > 1)
                {
                    scb.Location = screens[1].WorkingArea.Location;
                }
                scb.WindowState = FormWindowState.Maximized;
                scb.Show();
                try
                {
                    homelogopath  = getHomeLogoPath();
                    guestlogopath = getGuestLogoPath();
                }
                catch (Exception ex)
                {
                    homelogopath  = "Images.dummy.jpg";
                    guestlogopath = "Images.dummy.jpg";
                }

                try
                {
                    bgcolor       = getBGColor();
                    scb.BackColor = System.Drawing.Color.FromName(bgcolor);
                }
                catch (Exception ex)
                {
                    bgcolor = "LightGray";
                }

                try
                {
                    fontcolor = getFontColor();
                    scb.lbTextDown.ForeColor    = System.Drawing.Color.FromName(fontcolor);
                    scb.lbTextQuarter.ForeColor = System.Drawing.Color.FromName(fontcolor);
                    scb.lbTime.ForeColor        = System.Drawing.Color.FromName(fontcolor);
                    scb.lbTextHome.ForeColor    = System.Drawing.Color.FromName(fontcolor);
                    scb.lbTextGuest.ForeColor   = System.Drawing.Color.FromName(fontcolor);
                    scb.lbTitle.ForeColor       = System.Drawing.Color.FromName(fontcolor);
                }
                catch (Exception ex)
                {
                    fontcolor = "White";
                }

                timer1.Tick += new EventHandler(_timer_Tick);

                FileStream imageStreamHome = new FileStream(homelogopath, FileMode.Open, FileAccess.Read);
                scb.pBHome.Image = System.Drawing.Image.FromStream(imageStreamHome);
                FileStream imageStreamGuest = new FileStream(guestlogopath, FileMode.Open, FileAccess.Read);
                scb.pBGuest.Image = System.Drawing.Image.FromStream(imageStreamGuest);
            }
            catch (Exception ex)
            { }
        }