BF2Statistics.ScoreSettings.LoadConqFile C# (CSharp) Method

LoadConqFile() private method

Loads the conquest scoring file
We do a search and replace for the word DEFENT because the AIX devs spelled DEFEND incorrectly!
private LoadConqFile ( ) : bool
return bool
        private bool LoadConqFile()
        {
            string file;
            try
            {
                using (Stream Str = ScoringConqFile.Open(FileMode.Open, FileAccess.ReadWrite))
                using (StreamReader Rdr = new StreamReader(Str))
                    file = Rdr.ReadToEnd().Replace("SCORE_DEFENT", "SCORE_DEFEND");
            }
            catch (Exception e)
            {
                MessageBox.Show(
                    "Unable to Read/Write to the Conquest scoring file:" + Environment.NewLine
                    + Environment.NewLine + "File: " + ScoringConqFile.FullName
                    + Environment.NewLine + "Error: " + e.Message,
                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning
                    );

                this.Load += (s, ev) => this.Close();
                return false;
            }

            // Process
            if (!file.StartsWith("# BF2Statistics Formatted Conq Scoring"))
            {
                // We need to replace the default file with the embedded one that
                // Correctly formats the AI_ Scores
                string DefaultPath = Path.Combine(Program.RootPath, "Python", "ScoringFiles", "bf2_cq.py");
                string ModPath = Path.Combine(Program.RootPath, "Python", "ScoringFiles", MainForm.SelectedMod.Name + "_cq.py");

                file = (!File.Exists(ModPath)) ? File.ReadAllText(DefaultPath) : File.ReadAllText(ModPath);

                // Write formated data to the common soring file
                using (Stream Str = ScoringConqFile.Open(FileMode.Truncate, FileAccess.Write))
                using (StreamWriter Wtr = new StreamWriter(Str))
                {
                    Wtr.Write(file);
                    Wtr.Flush();
                }
            }

            ConqScores = new Dictionary<string, string[]>();
            MatchCollection Matches = Reg.Matches(file);
            foreach (Match m in Matches)
                ConqScores.Add(m.Groups["varname"].Value, new string[] { m.Groups["value"].Value, @"^" + m.Value + "(?:.*)$" });

            return true;
        }