コード例 #1
0
ファイル: SIOnlineViewModel.cs プロジェクト: wurunduk/SI
        private void InsertGame(GameInfo gameInfo)
        {
            var gameName = gameInfo.GameName;
            var length   = ServerGames.Count;

            var inserted = false;

            for (int i = 0; i < length; i++)
            {
                var comparison = ServerGames[i].GameName.CompareTo(gameName);
                if (comparison == 0)
                {
                    inserted = true;
                    break;
                }

                if (comparison > 0)
                {
                    ServerGames.Insert(i, gameInfo);
                    inserted = true;
                    break;
                }
            }

            if (!inserted)
            {
                ServerGames.Add(gameInfo);
            }
        }