コード例 #1
0
        private static void DisplayPlayer(IntralismScoreChecker.Player player)
        {
            UserProfileForm profileUserProfileForm = new(player.GlobalRank,
                                                         player.TotalGlobalRank,
                                                         player.Country,
                                                         player.CountryRank,
                                                         player.TotalCountryRank,
                                                         player.AverageMisses,
                                                         player.AverageAccuracy,
                                                         player.Points,
                                                         player.RealPoints,
                                                         player.MaximumPoints,
                                                         player.Difference,
                                                         player.HundredPlays,
                                                         player.TotalMaps,
                                                         player.RankUpPoints,
                                                         player.PictureLink,
                                                         player.Name);

            profileUserProfileForm.Show();

            UserScoreForm userScore = new(player.Scores, player.Name);

            userScore.Show();

            SaveLastChecked(player.Link);
            AddPlayerToDatabase(player);
        }
コード例 #2
0
        private static void AddPlayerToDatabase(IntralismScoreChecker.Player player)
        {
            List <IntralismScoreChecker.Player> playerList = new();

            if (!File.Exists("playerdatabase.json"))
            {
                playerList.Add(player);
                string uncompressedFile2 = JsonConvert.SerializeObject(playerList);
                byte[] compressedFile2   = Compressor.Zip(uncompressedFile2);
                File.WriteAllBytes("playerdatabase.json", compressedFile2 !);

                return;
            }

            byte[] compressedFile   = File.ReadAllBytes("playerdatabase.json");
            string uncompressedFile = Compressor.Unzip(compressedFile);

            if (!string.IsNullOrEmpty(uncompressedFile))
            {
                playerList = JsonConvert.DeserializeObject <List <IntralismScoreChecker.Player> >(uncompressedFile);
            }

            playerList.Add(player);
            uncompressedFile = JsonConvert.SerializeObject(playerList);
            compressedFile   = Compressor.Zip(uncompressedFile);
            File.WriteAllBytes("playerdatabase.json", compressedFile !);
        }