public static void LoadMatches(ref MatchList currentMatchList, string playerName, long summonerID)
        {
            var matchList = new List <Match>(); int partID = 0;

            string localFileName = $"{mainDirectoryName}\\{region}\\{playerName}\\matchDB.txt";

            LoL_DB.Clear();
            LoL_DB.ReadXml(localFileName);

            foreach (var match in LoL_DB.Match)
            {
                Match               baseMatch           = new Match();
                ParticipantIdent    participantIdentity = new ParticipantIdent();
                PlayerAsParticipant player      = new PlayerAsParticipant();
                Participant         participant = new Participant();
                ParticipantStats    stats       = new ParticipantStats();

                baseMatch.GameID       = match.GameID;
                baseMatch.QueueID      = match.QueueID;
                baseMatch.GameCreation = match.GameCreation;
                baseMatch.GameDuration = match.GameDuration;

                for (int i = 0; i < match.SummonerID.Length; i++)
                {
                    if (match.SummonerID[i] == summonerID)
                    {
                        participantIdentity.ParticipantID = match.ParticipantID[i];
                        player.SummonerId          = summonerID;
                        participantIdentity.Player = player;
                        partID = i;
                    }
                }

                List <ParticipantIdent> identificatioList = new List <ParticipantIdent>();
                identificatioList.Add(participantIdentity);
                baseMatch.ParticipantIdentities = identificatioList;

                participant.ChampionID = match.ChampionID[partID];
                stats.Win                = match.Win[partID];
                stats.ParticipantID      = match.ParticipantID[partID];
                stats.Kills              = match.Kills[partID];
                stats.Deaths             = match.Deaths[partID];
                stats.Assists            = match.Assists[partID];
                stats.GoldEarned         = match.GoldEarned[partID];
                stats.TotalMinionsKilled = match.TotalMinionsKilled[partID];
                participant.Stats        = stats;

                List <Participant> participantList = new List <Participant>();
                participantList.Add(participant);
                baseMatch.Participants = participantList;

                matchList.Add(baseMatch);
            }

            matchList.Reverse();
            currentMatchList.Matches = matchList;
            LoadDetailedMatches(playerName);
        }
Exemple #2
0
        public static void LoadChampions(ref Champions championList)
        {
            LoL_DB.Clear();
            LoL_DB.ReadXml(fileName);
            championList.Data = new Dictionary <string, ChampionData>();

            foreach (var champion in LoL_DB.Champion)
            {
                if (!championList.Data.ContainsKey(champion.Name))
                {
                    championList.Data.Add(champion.Name, new ChampionData(champion.Id, champion.Tags));
                }
            }
        }
        public static List <string> PlayersLoad()
        {
            var playerNames = new List <string>();

            LoL_DB.Clear();
            LoL_DB.ReadXml(fileName);

            foreach (var row in LoL_DB.Player)
            {
                if (!playerNames.Contains(row.Name))
                {
                    playerNames.Add(row.Name);
                }
            }

            return(playerNames);
        }
        public static bool MatchesExist(string playerName, string currentRegion)
        {
            LoL_DB = new LoLDataBase();

            region   = currentRegion;
            fileName = $"{mainDirectoryName}\\{region}\\{playerName}\\matchDB.txt";

            if (File.Exists(fileName))
            {
                LoL_DB.Clear();
                LoL_DB.ReadXml(fileName);

                return(true);
            }

            return(false);
        }
        public static bool PlayerExists(string playerName, string currentRegion)
        {
            LoL_DB   = new LoLDataBase();
            region   = currentRegion;
            fileName = $"{mainDirectoryName}\\{region}\\players_DB.txt";

            if (File.Exists(fileName))
            {
                LoL_DB.Clear();
                LoL_DB.ReadXml(fileName);

                foreach (var player in LoL_DB.Player)
                {
                    if (player.Name == playerName)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }