예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            // as all we get from the context is the Global instance,
            // which doesn't change, we can safely re-use an existing
            // instance thanks to IsReusable being true
            if (gamelist == null)
            {
                lock (_GamelistNullLock)
                {
                    if (gamelist == null)
                    {
                        gamelist = new GameList((Global)(context.ApplicationInstance));
                    }
                }
            }

            switch (context.Request.RequestType)
            {
                case "GET":
                    GetGames(context);
                    break;
                case "POST":
                case "PUT":
                    PostGame(context);
                    break;
                case "DELETE":
                    DeleteGame(context);
                    break;
                default:
                    context.Response.StatusCode = 405; // Method Not Allowed
                    context.Response.Headers.Add("Allow", "GET, POST, PUT, DELETE");
                    break;
            }
        }
예제 #2
0
 private void clearAddGames(GameList g)
 {
     games.Clear();
     foreach (Game game in g.Games)
     {
         Games.Add(game);
     }
 }
 public ActionResult Index()
 {
     var model = new GameList();
     foreach (RockPaperScissorsSession game in _game.Sessions)
     {
         model.Add(new Tuple<string, string>(game.Id.ToString(), game.Name));
     }
     return View(model);
 }
예제 #4
0
        public GamesListBox()
        {
            InitializeComponent();
            this.DoubleBuffered = true;

            games = new GameList<Game>();
            //Paint += new PaintEventHandler(GamesListBox_Paint);
            MouseDown += new MouseEventHandler(GamesListBox_MouseDown);
            vScrollBar1.ValueChanged += new EventHandler(vScrollBar1_ValueChanged);
        }
예제 #5
0
        public static AutoCatConfigPanel CreatePanel(AutoCat ac, GameList ownedGames, List <AutoCat> autocats)
        {
            AutoCatType t = ac.AutoCatType;

            switch (t)
            {
            case AutoCatType.Genre:
                return(new AutoCatConfigPanel_Genre());

            case AutoCatType.Flags:
                return(new AutoCatConfigPanel_Flags());

            case AutoCatType.Tags:
                return(new AutoCatConfigPanel_Tags(ownedGames));

            case AutoCatType.Year:
                return(new AutoCatConfigPanel_Year());

            case AutoCatType.UserScore:
                return(new AutoCatConfigPanel_UserScore());

            case AutoCatType.Hltb:
                return(new AutoCatConfigPanel_Hltb());

            case AutoCatType.Manual:
                return(new AutoCatConfigPanel_Manual(ownedGames));

            case AutoCatType.DevPub:
                return(new AutoCatConfigPanel_DevPub(ownedGames));

            case AutoCatType.Group:
                return(new AutoCatConfigPanel_Group(autocats));

            case AutoCatType.Name:
                return(new AutoCatConfigPanel_Name());

            case AutoCatType.VrSupport:
                return(new AutoCatConfigPanel_VrSupport());

            case AutoCatType.Language:
                return(new AutoCatConfigPanel_Language());

            case AutoCatType.Curator:
                return(new AutoCatConfigPanel_Curator());

            case AutoCatType.Platform:
                return(new AutoCatConfigPanel_Platform());

            default:
                return(null);
            }
        }
예제 #6
0
        public void Part()
        {
            if (this.Clients != null)
            {
                ClearClients();
            }

            if (this.Messages != null && this.Messages.Count > 0)
            {
                this.AddMessage(this.Server.User, "has left the channel.", MessageSettings.PartMessage);
                Log(Messages.Count, true);
                Messages.Clear();
            }

            if (GameList != null)
            {
                GameList.Clear();
            }
            if (userMessages != null)
            {
                userMessages.Clear();
            }
            if (TheFlowDocument != null)
            {
                TheFlowDocument.Blocks.Clear();
            }

            if (!IsPrivMsgChannel)
            {
                this.LoadDisconnectedLayout();
                Joined = false;
            }

            if (this.IsReconnecting)
            {
                this.Reconnecting(false);
            }
            else if (this.IsLoading)
            {
                this.Loading(false);
            }

            if (this.Server.IsWormNet)
            {
                this.Server.LeaveChannel(this.Name);
            }
            else
            {
                mw.GameSurgeIsConnected = false;
                this.Server.Cancel      = true;
            }
        }
예제 #7
0
        public async Task <IActionResult> Create([Bind("Id,PlayerId,GameId,DeltaMoney")] GameList gameList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gameList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GameId"]   = new SelectList(_context.Game, "Id", "Id", gameList.GameId);
            ViewData["PlayerId"] = new SelectList(_context.Players, "Id", "Login", gameList.PlayerId);
            return(View(gameList));
        }
예제 #8
0
    public static void Save()
    {
        string dt = DateTime.Now.ToString("s", new System.Globalization.CultureInfo("ja-JP"));

        GameList.Instance.saveDate = dt;
        GameList.Save();
        CourtList.Instance.saveDate = dt;
        if (CourtList.Instance.coutList.Count() == 0)
        {
            CourtList.Instance.coutList.Add(new int());
        }
        CourtList.Save();
    }
예제 #9
0
        public DlgAutoCat(List <AutoCat> autoCats, GameList ownedGames)
        {
            InitializeComponent();

            AutoCatList = new List <AutoCat>();

            foreach (AutoCat c in autoCats)
            {
                AutoCatList.Add(c.Clone());
            }

            this.ownedGames = ownedGames;
        }
예제 #10
0
        public UserProfileVM()
        {
            DisplayName       = AccountHandler.SetDisplayNameForUI;
            _joinedDate       = AccountHandler.AccountDetail.JoinDate;
            _yearDifference   = _thisYear - Convert.ToInt32(_joinedDate.Split("/")[2]);
            _gamesOwnedCount  = AccountHandler.AccountDetail.GamesOwnedCount;
            _profileImagePath = AccountHandler.SetProfileImagePathForUI;
            RecentPurchases   = GetRecentPurchases();

            _gameList = GameList.Instance;
            LoadGames();
            _selectedPurchase = null;
        }
        public AutoCatConfigPanel_Tags(GameList ownedGames)
        {
            this.ownedGames = ownedGames;

            InitializeComponent();

            ttHelp.Ext_SetToolTip(helpPrefix, GlobalStrings.DlgAutoCat_Help_Prefix);
            ttHelp.Ext_SetToolTip(list_helpMinScore, GlobalStrings.DlgAutoCat_Help_ListMinScore);
            ttHelp.Ext_SetToolTip(list_helpOwnedOnly, GlobalStrings.DlgAutoCat_Help_ListOwnedOnly);
            ttHelp.Ext_SetToolTip(helpTagsPerGame, GlobalStrings.DlgAutoCat_Help_ListTagsPerGame);
            ttHelp.Ext_SetToolTip(helpWeightFactor, GlobalStrings.DlgAutoCat_Help_ListWeightFactor);
            ttHelp.Ext_SetToolTip(list_helpScoreSort, GlobalStrings.DlgAutoCat_Help_ListScoreSort);
            ttHelp.Ext_SetToolTip(helpExcludeGenres, GlobalStrings.DlgAutoCat_Help_ListExcludeGenres);
        }
예제 #12
0
        static void Main(string[] args)
        {
            UserModel user = new Model.UserModel();

            Model.Display    display   = new Model.Display();
            Model.Infomation info      = new Model.Infomation();
            GameList         Game      = new GameList();
            gameInformation  gameInfor = new gameInformation();

            string[] users = System.IO.File.ReadAllLines("D:\\Data\\SourceTree\\Train\\Week_1\\Project_Week_1\\Project_Week_1\\DB\\DB.txt");

            /*display.signUpScreen(user);
             * user.register();
             * display.signInScreen(user);
             * user.logIn();
             * display.inFormation(user);*/
lap:
            Console.Write("Chon chuc nang ban muon:\n1.Dang Ki\n2.Dang Nhap\nChuc Nang Ban Chon La: ");
            string chon = Console.ReadLine();

            switch (chon)
            {
            case "1":
                Console.WriteLine("\nDang Ki: ");
                display.signUpScreen(user);
                if (user.register() == true)
                {
                    goto lap;
                }
                break;

            case "2":
                Console.WriteLine("\nDang Nhap:");
                display.signInScreen(user);
                if (user.logIn())
                {
                    info.infoMation(user, display, Game, gameInfor);
                }
                else
                {
                    goto lap;
                }

                break;

            default: { Console.WriteLine("Ban da nhap sai vui long nhap lai\n"); goto lap; }
            }

            Console.ReadKey();
        }
예제 #13
0
        public void AddOrUpdate(GameList gameList)
        {
            var oldgamelist = Find(gameList.Id);

            if (oldgamelist == null)
            {
                gameList.AddedDate = DateTime.Now;
                Add(gameList);
            }
            else if (_userService.IsOwner(oldgamelist.UserList.UserId))
            {
                Update(gameList);
            }
        }
예제 #14
0
 private static bool UpdateGameList_Web_Html(Profile profile)
 {
     try
     {
         string doc = GameList.FetchHtmlGameList(profile.SteamID64);
         profile.GameData.IntegrateHtmlGameList(doc, false, profile.IgnoreList, out int newApps);
         return(true);
     }
     catch (Exception e)
     {
         Logger.Exception("Automatic mode: Error on HTML web profile update.", e);
         return(false);
     }
 }
예제 #15
0
        public GamesListBox()
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            timer = new Timer();
            timer.Interval = 1000 / 40;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
            games = new GameList<Game>();
            //Paint += new PaintEventHandler(GamesListBox_Paint);

            MouseDown += new MouseEventHandler(GamesListBox_MouseDown);
            vScrollBar1.ValueChanged += new EventHandler(vScrollBar1_ValueChanged);
        }
예제 #16
0
        public async Task <List <Game> > Get()
        {
            IMongoClient client     = new MongoClient();
            var          database   = client.GetDatabase("scorekeeper");
            var          collection = database.GetCollection <Game>("collectionOne");
            GameList     gameList   = new GameList();

            gameList.games = new List <Game>();
            await collection.Find(new BsonDocument()).ForEachAsync(X => {
                gameList.games.Add(X);
            });

            return(gameList.games);
        }
예제 #17
0
        public IHttpActionResult GetGameList(string userId)
        {
            var model = new GameList();

            model.Games = new List <GameSummary>();

            var quizzes = quizDb.Quizzes.Where(x => x.IsPubslished).ToList();

            foreach (var quiz in quizzes)
            {
                var statisticsService = new GameStatisticsService(quiz.Id, userId);

                // TODO: Liste auswerten
                var gameModel = new GameSummary();

                gameModel.Name           = quiz.Name;
                gameModel.QuizId         = quiz.Id;
                gameModel.QuestionCount  = statisticsService.GetQuestions().Count;
                gameModel.MyGameCount    = statisticsService.GetMyGames().Count;        // wie oft habe ich gespielt
                gameModel.TotalGameCount = statisticsService.GetTotalGames().Count;

                var bestGame = statisticsService.GetBestGame();
                if (bestGame != null)
                {
                    gameModel.BestGame = new GameApproach
                    {
                        PlayDateTime = bestGame.Game.CreatedAt,
                        Rank         = 0,
                        Score        = bestGame.CorrectAnswerCount
                    };
                }

                var lastGame = statisticsService.GetLastGame();
                if (lastGame != null)
                {
                    gameModel.LastGame = new GameApproach
                    {
                        PlayDateTime = lastGame.Game.CreatedAt,
                        Rank         = 0,
                        Score        = lastGame.CorrectAnswerCount
                    };
                }

                model.Games.Add(gameModel);
            }



            return(Ok(model));
        }
예제 #18
0
 private static bool UpdateGameList_Web_Xml(Profile profile)
 {
     try
     {
         IXPathNavigable doc = GameList.FetchGameList(profile.SteamID64);
         profile.GameData.IntegrateGameList(doc, false, profile.IgnoreList, out int _);
         return(true);
     }
     catch (Exception e)
     {
         Logger.Exception("Automatic mode: Error on XML web profile update.", e);
         return(false);
     }
 }
예제 #19
0
        public GamesListBox()
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            timer          = new Timer();
            timer.Interval = 1000 / 40;
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Start();
            games = new GameList <Game>();
            //Paint += new PaintEventHandler(GamesListBox_Paint);

            MouseDown += new MouseEventHandler(GamesListBox_MouseDown);
            vScrollBar1.ValueChanged += new EventHandler(vScrollBar1_ValueChanged);
        }
예제 #20
0
 public AccountSettings()
 {
     this.InitializeComponent();
     _navigationHandler = NavigationHandler.Instance;
     vm                    = DataContext as AccountSettingsVM;
     _imagePicker          = new FileOpenPicker();
     _imagePicker.ViewMode = PickerViewMode.Thumbnail;
     _imagePicker.SuggestedStartLocation = PickerLocationId.Desktop;
     _imagePicker.FileTypeFilter.Add(".jpg");
     _imagePicker.FileTypeFilter.Add(".jpeg");
     _imagePicker.FileTypeFilter.Add(".png");
     _imagePicker.FileTypeFilter.Add(".gif");
     _gameList = GameList.Instance;
 }
예제 #21
0
        private void RibbonButtonClick(object sender, RoutedEventArgs e)
        {
            var gl = frame1.Content as GameList;

            if (gl == null)
            {
                gl              = new GameList(GameList.LoadEvent.InstallGame);
                gl.OnGameClick += gl_OnGameDoubleClick;
                frame1.Navigate(gl);
            }
            else
            {
                gl.InstallGame();
            }
        }
        public void Test_Adding_A_GameList_With_ExistingID()
        {
            var      context            = new UniAppKidsDbContext();
            var      aGenericRepository = new GenericRepository <GameList>(context);
            GameList aGameList          = new GameList()
            {
                GameName =
                    "http://en.educaplay.com/en/learningresources/1696028/html5/nombres_propios.htm#!",
                DifficultyLevel      = 1,
                AssignedGameObjectId = 1
            };

            aGenericRepository.Insert(aGameList);
            context.SaveChanges();
        }
예제 #23
0
 private bool UpdateGameList_Web_Xml(Profile profile)
 {
     try
     {
         XmlDocument doc = GameList.FetchXmlGameList(profile.SteamID64);
         int         newApps;
         profile.GameData.IntegrateXmlGameList(doc, false, profile.IgnoreList, out newApps);
         return(true);
     }
     catch (Exception e)
     {
         Program.Logger.WriteException("Automatic mode: Error on XML web profile update.", e);
         return(false);
     }
 }
예제 #24
0
    // Start is called before the first frame update
    void Start()
    {
        if (isForGames)
        {
            GameList games = JsonUtility.FromJson <GameList>(jsonFile.text);

            GameController.Instance.games    = games.games;
            GameController.Instance.nextGame = games.games[0];
        }
        else
        {
            TutsList tuts = JsonUtility.FromJson <TutsList>(jsonFile.text);

            GetComponent <Tutorial>().tuts = tuts.tutorialTexts;
        }
    }
예제 #25
0
        public async Task <IActionResult> Get([FromRoute] string name)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            GameList gameList = await _context.GameList.FirstOrDefaultAsync(m => m.Name == name);

            if (gameList == null)
            {
                return(NotFound());
            }

            return(Ok(gameList));
        }
예제 #26
0
파일: GameDB.cs 프로젝트: samuelarbibe/taki
        public GameList SelectByUserId(int userId)
        {
            Command.Parameters.Clear();

            Command.CommandText = "SELECT * FROM Game_Table WHERE(ID IN " +
                                  "(SELECT Player_Game_Table.game_id" +
                                  " FROM(Player_Table INNER JOIN" +
                                  " Player_Game_Table ON Player_Table.ID = Player_Game_Table.player_id)" +
                                  " WHERE (Player_Table.user_id = @Id)))";

            Command.Parameters.Add(new OleDbParameter("@Id", userId));

            GameList temp = new GameList(Select());

            return(temp);
        }
예제 #27
0
 private bool UpdateGameList_Web_Html(Profile profile)
 {
     try
     {
         string doc = GameList.FetchHtmlGameList(profile.SteamID64);
         int    newApps;
         profile.GameData.IntegrateHtmlGameList(doc, false, profile.IgnoreList,
                                                profile.IncludeUnknown ? AppTypes.InclusionUnknown : AppTypes.InclusionNormal, out newApps);
         return(true);
     }
     catch (Exception e)
     {
         Program.Logger.WriteException("Automatic mode: Error on HTML web profile update.", e);
         return(false);
     }
 }
예제 #28
0
    protected void ViewMutualGamesButton_Clicked(Object sender, EventArgs e)
    {
        GameList gl = service.GetMutualGames(u1.Id, u2.Id);

        if (gl.Count > 0)
        {
            GridView1.DataSource = gl;
            GridView1.DataBind();

            MutualGamesDiv.Visible = true;
        }
        else
        {
            NoGamesDiv.Visible = true;
        }
    }
예제 #29
0
        public async Task <GameList> GetGameList(GameListType listType = GameListType.All)
        {
            var client = new HttpClient();
            var xml    = await client.GetStringAsync(
                $"http://steamcommunity.com/id/{this._userData.Username}/games?tab=all&xml=1");

            var ser  = new XmlSerializer(typeof(SteamGamesList));
            var list = (SteamGamesList)ser.Deserialize(new StringReader(xml));

            var result = new GameList();

            result.AddRange(list.Games.Select(steam => new GameEntry {
                Name = steam.Name
            }));
            return(result);
        }
예제 #30
0
        public void PresetGame2()
        {
            GameList.Clear();
            for (int i = 0; i < 9; i++)
            {
                GameList.Add(new ObservableCollection <int>());
                for (int j = 0; j < 9; j++)
                {
                    GameList[i].Add(0);
                }
            }
            GameList[0][0] = 1;
            GameList[0][4] = 2;
            GameList[0][5] = 3;

            GameList[1][2] = 5;
            GameList[1][3] = 4;
            GameList[1][5] = 6;

            GameList[2][2] = 4;
            GameList[2][4] = 5;
            GameList[2][7] = 6;

            GameList[3][0] = 9;
            GameList[3][2] = 4;
            GameList[3][7] = 5;

            GameList[4][3] = 5;
            GameList[4][4] = 6;
            GameList[4][5] = 7;

            GameList[5][1] = 7;
            GameList[5][6] = 8;
            GameList[5][8] = 3;

            GameList[6][1] = 4;
            GameList[6][4] = 3;
            GameList[6][6] = 2;

            GameList[7][3] = 7;
            GameList[7][5] = 1;
            GameList[7][6] = 8;

            GameList[8][3] = 9;
            GameList[8][4] = 8;
            GameList[8][8] = 7;
        }
        private void Explore(GameList games, int startIndex, Action <GameList, List <int>, List <TeamResult>, int, double> callback)
        {
            /*
             * Thinking about recursive return
             *      Looking for a game where winner/loser determines whether a team has any chance to win the division
             *      Two cases:
             *              Hit an endpoint:
             *                      return the division winner
             *              Ran child recursions:
             *                      Get possible winner lists for both children
             *                      If a team exists in one list but not the other, we have a crucial game
             *      PROBLEM:
             *              Permutator doesn't know who won...
             *              Would need judgment to be a synchronous call for the permutator
             */
            if (startIndex >= games.Count)
            {
                //Reached an endpoint, output a permutation
                CompletedPermutations++;

                List <int> winners = new List <int>();
                foreach (Game winnerGame in games)
                {
                    winners.Add(winnerGame.WinnerId);
                }

                List <TeamResult> results = new List <TeamResult>();
                foreach (TeamResult result in games.Results.Values)
                {
                    results.Add(new TeamResult(result));
                }

                callback(games, winners, results, CompletedPermutations, TotalPermutations);
                return;
            }

            //Recursively call to explore 1) home team winning and 2) away team winning
            Game game = games[startIndex];

            games.SetProposedGameWinner(startIndex, game.HomeTeamId);
            Explore(games, startIndex + 1, callback);

            games.SetProposedGameWinner(startIndex, game.AwayTeamId);
            Explore(games, startIndex + 1, callback);

            games.SetProposedGameWinner(startIndex, null);
        }
예제 #32
0
        private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (DataGrid.SelectedItem == null)
            {
                SubmitBtn.Visibility = Visibility.Collapsed;
                return;
            }

            //change submit/update button
            UpdateBtn.Visibility = Visibility.Visible;

            _tempUser   = DataGrid.SelectedItem as User;
            DataContext = _tempUser;

            if (_tempUser.Id != 999)
            {
                GameList dataList = MainWindow.Service.GetAllUserGames(_tempUser.Id);


                if (dataList == null)
                {
                    State.Text       = "Error Retrieving Lesson Data";
                    State.Foreground = Brushes.Red;
                    State.FontSize   = 9;
                }
                else if (dataList.Count == 0)
                {
                    State.Text          = "No Game History";
                    State.Foreground    = Brushes.Red;
                    State.FontSize      = 9;
                    GameGrid.Visibility = Visibility.Hidden;
                    DataGrid.Height     = 370;
                    GameGrid.Height     = 0;
                }
                else
                {
                    GameGrid.Visibility  = Visibility.Visible;
                    DataGrid.Height      = 170;
                    GameGrid.Height      = 170;
                    State.Text           = "Success";
                    State.Foreground     = Brushes.Gray;
                    State.FontSize       = 11;
                    GameGrid.ItemsSource = dataList;
                }
            }
            DeleteBtn.Visibility = Visibility.Visible;
        }
예제 #33
0
 public GamePlayManager(
     Settings settings,
     LayoutBuilder layoutBuilder,
     GameList gameList,
     GameListStore gameListStore,
     HotKeyManager hotKeyManager,
     PowerManager powerManager,
     MameInvoker invoker)
 {
     _settings      = settings;
     _layoutBuilder = layoutBuilder;
     _gameList      = gameList;
     _gameListStore = gameListStore;
     _hotKeyManager = hotKeyManager;
     _powerManager  = powerManager;
     _invoker       = invoker;
 }
예제 #34
0
        /// <summary>
        /// Removes first party memeber in queue of party up requests
        /// </summary>
        public async Task CmdPopPartyUpRequest()
        {
            try
            {
                // get current game info
                ChannelJSON json = await _twitchInfo.GetBroadcasterChannelById();

                string   gameTitle = json.Game;
                GameList game      = await _gameDirectory.GetGameId(gameTitle);

                _irc.SendPublicChatMessage(await _partyUp.PopRequestedPartyMember(game.Id, _broadcasterId));
            }
            catch (Exception ex)
            {
                await _errHndlrInstance.LogError(ex, "CmdMod", "CmdPopPartyUpRequest()", false, "!poppartyuprequest");
            }
        }
예제 #35
0
        private void LoadGameList(string yearIn)
        {
            Logger.Trace(string.Format("LoadGameList: Loading {0} game List...", yearIn));

            if (GameList == null)
            {
                GameList = new List <NFLGame>();
            }
            var gameDt = Utility.TflWs.GetSeasonDt(yearIn);

            foreach (var g in from DataRow dr in gameDt.Rows select new NFLGame(dr))
            {
                GameList.Add(g);
            }

            Logger.Trace($"LoadGameList: Loaded {GameList.Count} games.");
        }
예제 #36
0
        public void ListTest()
        {
            var simplelist = new List<object>();

            object item1 = new object();
            object item2 = new object();
            object item3 = new object();
            object item4NotContains = new object();

            simplelist.Add(item1);
            simplelist.Add(item2);
            simplelist.Add(item3);

            var gameList = new GameList<object>();

            foreach (object o in simplelist)
            {
                gameList.Add(o);
            }

            foreach (object o in gameList)
            {
                Assert.IsTrue(simplelist.Contains(o));
            }

            foreach (object o in simplelist)
            {
                Assert.IsTrue(gameList.Contains(o));
            }

            Assert.IsFalse(gameList.Contains(item4NotContains));
            Assert.AreEqual(gameList.Count, 3);

            gameList.Remove(x => ReferenceEquals(x, item2));
            Assert.IsFalse(gameList.Contains(item2));
            Assert.AreEqual(gameList.Count, 2);

            gameList.Clear();
            Assert.AreEqual(gameList.Count, 0);
        }
예제 #37
0
 /// <summary>
 /// Updates the games collection
 /// </summary>
 /// <param name="g"></param>
 public void onGamesChanged(GameList g)
 {
     System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => clearAddGames(g)));
     
 }
예제 #38
0
        public int LoadGames(Boolean includeMissing = false)
        {
            this.Games = new GameList();

            string xmlFile = "Games.xml";
            string xmlPath = Path.Combine(Application.StartupPath, xmlFile);
            if (!File.Exists(xmlPath))
            {
                xmlPath = Path.Combine(SpecialFolder.GetSavedGames(), xmlFile);
                if (!File.Exists(xmlPath))
                {
                    throw new Exception(string.Format("{0} not found", xmlFile));
                }
            }

            return this.Games.LoadGames(xmlPath, includeMissing);
        }
예제 #39
0
        /// <summary>
        /// Parses LoginSuccess instructions for users
        /// and adds them to the UserList
        /// </summary>
        /// <param name="content">Byte array containing
        /// all recieved buffer</param>
        /// <param name="users">Userlist to add to</param>
        /// returns index of beginning of gamelist
        /// <param name="games">Game list to add 
        /// games to</param>
        /// <param name="currindex">index of buffer to
        /// begin parsing</param>
        public static void parseUsersGames(byte[] content, ref UserList users, ref GameList games, int currindex)
        {

            currindex += 2;      
            int numUsers = BitConverter.ToInt32(content, currindex);
            currindex += 4;
            int numGames = BitConverter.ToInt32(content, currindex);
            currindex += 4;

            //Parse the users
            for (int i = 0; i < numUsers; i++)
            {
                User user = new User();
                StringBuilder usrName = new StringBuilder();
                while (content[currindex] != 0)
                {
                    usrName.Append((char)content[currindex++]);
                }
                user.Name = usrName.ToString();
                currindex++;
                user.ping = BitConverter.ToInt32(content, currindex);
                currindex += 4;
                user.status = content[currindex];
                currindex++;
                user.id = BitConverter.ToInt16(content, currindex);
                currindex += 2;
                user.connection = content[currindex++];
                user.assignCategory();
                users.AddUser(user);
            }

            //Now for the games
            for (int i = 0; i < numGames; i++)
            {
                Game game = new Game();
                StringBuilder gamename = new StringBuilder();
                while (content[currindex] != 0)
                {
                    gamename.Append((char)content[currindex++]);
                }
                game.name = gamename.ToString();
                currindex++;
                game.id = BitConverter.ToInt32(content, currindex);
                currindex += 4;
                StringBuilder emuName = new StringBuilder();
                while (content[currindex] != 0)
                {
                    emuName.Append((char)content[currindex++]);
                }
                game.emuName = emuName.ToString();
                currindex++;
                StringBuilder hostUser = new StringBuilder();
                
                while (content[currindex] != 0)
                {
                    hostUser.Append((char)content[currindex++]);
                }


                game.gameHost = hostUser.ToString();
                currindex++;

                StringBuilder usersStr = new StringBuilder();

                while (content[currindex] != 0)
                {
                    usersStr.Append((char)content[currindex++]);
                }

                //Note property setter also sets game users and max users
                game.Users_count = usersStr.ToString();

                game.status = content[++currindex];
                games.AddGame(game);
                currindex++;

            }
        }
예제 #40
0
 public static int ReadConfig()
 {
     var deserializer = new Deserializer();
     try {
         using (StreamReader input = new StreamReader(configFile))
         {
             settings = deserializer.Deserialize<AMESettings>(input);
         }
     }
     catch (FileNotFoundException ex)
     {
         FileNotFound(ex);
         return -1;
     }
     catch (YamlException ex)
     {
         
         ShowMessageBox(rmInternalStrings.GetString("UnableToReadConfig") + " " + configFile + ".\n\n" + ex.Message, rmInternalStrings.GetString("UnableToReadConfigTitle"), "OK", "Error");
         return -1;
     }
     try
     {
         using (StreamReader input = new StreamReader(gamesFile))
         {
             gameList = deserializer.Deserialize<GameList>(input);
         }
     }
     catch (FileNotFoundException ex)
     {
         FileNotFound(ex);
         return -1;
     }
     catch (YamlException ex)
     {
         
         ShowMessageBox(rmInternalStrings.GetString("UnableToReadConfig") + " " + gamesFile + ".\n\n" + ex.Message, rmInternalStrings.GetString("UnableToReadConfigTitle"), "OK", "Error");
         return -1;
     }
     try
     {
         using (StreamReader input = new StreamReader(tableFile))
         {
             charTable = deserializer.Deserialize<CharTable>(input);
         }
     }
     catch (FileNotFoundException ex)
     {
         FileNotFound(ex);
         return -1;
     }
     catch (YamlException ex)
     {
         
         ShowMessageBox(rmInternalStrings.GetString("UnableToReadConfig") + " " + tableFile + ".\n\n" + ex.Message, rmInternalStrings.GetString("UnableToReadConfigTitle"), "OK", "Error");
         return -1;
     }
     try
     {
         using (StreamReader input = new StreamReader(behaviorBytesFile))
         {
             behaviorLists = deserializer.Deserialize<BehaviorLists>(input);
         }
     }
     catch (FileNotFoundException ex)
     {
         FileNotFound(ex);
         return -1;
     }
     catch (YamlException ex)
     {
         
         ShowMessageBox(rmInternalStrings.GetString("UnableToReadConfig") + " " + behaviorBytesFile + ".\n\n" + ex.Message, rmInternalStrings.GetString("UnableToReadConfigTitle"), "OK", "Error");
         return -1;
     }
     try
     {
         using (StreamReader input = new StreamReader(musicListFile))
         {
             musicLists = deserializer.Deserialize<MusicLists>(input);
         }
     }
     catch (FileNotFoundException ex)
     {
         FileNotFound(ex);
         return -1;
     }
     catch (YamlException ex)
     {
         
         ShowMessageBox(rmInternalStrings.GetString("UnableToReadConfig") + " " + musicListFile + ".\n\n" + ex.Message, rmInternalStrings.GetString("UnableToReadConfigTitle"), "OK", "Error");
         return -1;
     }
     return 0;
 }
예제 #41
0
 public GamesCollection()
 {
     games = new GameList<Game>();
 }
 public GamesController(GameList games)
 {
     _games = games;
 }