Exemple #1
0
        //Single use function
        static void Fix()
        {
            foreach (FileInfo f in (new DirectoryInfo(Environment.CurrentDirectory).EnumerateFiles("map_*")))
            {
                Dictionary <string, string> output = new Dictionary <string, string>();
                string[] split = f.Name.Replace(".txt", "").Split('_');
                Realm  = split[1];
                Region = split[2];
                Console.WriteLine($"Fixing {Region}@{Realm}");
                using (StreamReader sr = new StreamReader(f.Name))
                {
                    string str;
                    while ((str = sr.ReadLine()) != null)
                    {
                        split = str.Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries);
                        output.Add(split[0], split[1]);
                    }
                }
                var keys = output.Keys.ToArray();
                foreach (string v in keys)
                {
                    var p = new ManifestManager.SolutionManifest("lol_game_client_sln", v).Projects[0];
                    output[v] += $" ({p.Version})";
                }

                using (StreamWriter sw = new StreamWriter(f.Name, false))
                {
                    foreach (string v in keys)
                    {
                        sw.WriteLine($"{v} -> {output[v]}");
                    }
                }
            }
        }
        private void GameClientComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (DisableHanders)
                return;
            this.Invoke((Action)delegate
            {
                GameClientVersionLabel.Show();
                GameClientVersionLabel.Text = "Loading data...";
                this.GameVersion = GameClientComboBox.SelectedItem.ToString();
            });
            this.PerformTask((Action)delegate
            {
                string data = "";
                if (GameVersionDictionary.Count == 0)
                {
                    try
                    {
                        using (WebClient wc = new WebClient())
                        {
                            string[] split;
                            string tmp = wc.DownloadString($"https://raw.githubusercontent.com/PowerOfDark/LoLPatchResolver/master/output/map_{ManifestManager.Program.Realm}_{ManifestManager.Program.Region}.txt");
                            var list = tmp.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (string s in list)
                            {
                                split = s.Split(new string[] { " -> " }, StringSplitOptions.None);
                                GameVersionDictionary.Add(split[0], split[1]);
                            }
                        }
                    }
                    catch { }
                }
                if (GameVersionDictionary.ContainsKey(GameVersion))
                {
                    data = GameVersionDictionary[GameVersion];
                }
                else
                {
                    //Do it manually
                    var p = new ManifestManager.SolutionManifest("lol_game_client_sln", GameVersion).Projects[0];
                    data = ManifestManager.Utils.GetClientVersion(p.GetReleaseManifest()) + $" ({p.Version})";
                    p = null;
                    GameVersionDictionary.Add(GameVersion, data);
                }

                GC.Collect();
                this.Invoke((Action)delegate
                {
                    GameClientVersionLabel.Text = data;
                });
            });
        }
        //Single use function
        static void Fix()
        {
            foreach(FileInfo f in (new DirectoryInfo(Environment.CurrentDirectory).EnumerateFiles("map_*")))
            {
                Dictionary<string, string> output = new Dictionary<string, string>();
                string[] split = f.Name.Replace(".txt", "").Split('_');
                Realm = split[1];
                Region = split[2];
                Console.WriteLine($"Fixing {Region}@{Realm}");
                using (StreamReader sr = new StreamReader(f.Name))
                {
                    string str;
                    while ((str = sr.ReadLine()) != null)
                    {
                        split = str.Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries);
                        output.Add(split[0], split[1]);
                    }
                }
                var keys = output.Keys.ToArray();
                foreach (string v in keys)
                {
                    var p = new ManifestManager.SolutionManifest("lol_game_client_sln", v).Projects[0];
                    output[v] += $" ({p.Version})";
                }

                using (StreamWriter sw = new StreamWriter(f.Name, false))
                {
                    foreach (string v in keys)
                    {
                        sw.WriteLine($"{v} -> {output[v]}");
                    }
                }

            }
        }