private void Playing_FormClosing(object sender, FormClosingEventArgs e) { if (Missed < ModeSettings.WrongTimesLimit) { DialogResult dg = MessageBox.Show("Are you wanna save to play after (by Lastest Play mode)?", "Word Jumble", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dg == DialogResult.Yes) { WordJumble.Properties.Settings.Default.Mode4Resume = PlayMode; ResumeSettings.SetUp(Point, Bonus, Missed, WinTimes, TotalWin, progBonus.Value, HintLimit, ChangeQuestionLimit, ReduceLimit); ResumeSettings.SaveSettings(); WordJumble.Properties.Settings.Default.ModeLastest = true; WordJumble.Properties.Settings.Default.Save(); } else { WordJumble.Properties.Settings.Default.ModeLastest = false; } } timeCount.Stop(); SaveScores scObject = new SaveScores(); HighestScores hscObject = new HighestScores(); if (Point > 5 && (hscObject.IsHighestScore(Point) || hscObject.IsTopTen() || !hscObject.IsExist())) { SaveScoresSettings.SetUp(TimeLimit, Point, Bonus, Missed); SaveScoresSettings.SaveSettings(); scObject.ShowDialog(); } }
/// <summary> /// Load game from file /// </summary> /// <param name="FileName">File to load</param> public static void Process(string FileName) { using (StreamReader sReader = new StreamReader(FileName)) { while (!sReader.EndOfStream) { string line = sReader.ReadLine(); if (line.Contains("Mode:")) { WordJumble.Properties.Settings.Default.Mode4Resume = line.Remove(0, 6); } else if (line.Contains("Point:")) { ResumeSettings.Point = Int32.Parse(line.Remove(0, 7)); } else if (line.StartsWith("Bonus:")) { ResumeSettings.Bonus = Int32.Parse(line.Remove(0, 7)); } else if (line.Contains("Missed:")) { ResumeSettings.Missed = Int32.Parse(line.Remove(0, 8)); } else if (line.Contains("Total Win:")) { ResumeSettings.TotalWin = Int32.Parse(line.Remove(0, 11)); } else if (line.Contains("Win Times:")) { ResumeSettings.WinTimes = Int32.Parse(line.Remove(0, 11)); } else if (line.Contains("Prepare Bonus:")) { ResumeSettings.PrepareBonus = Int32.Parse(line.Remove(0, 15)); } else if (line.Contains("Hint Limit:")) { ResumeSettings.HintLimit = Int32.Parse(line.Remove(0, 12)); } else if (line.Contains("Change Question Limit:")) { ResumeSettings.ChangeQuestionLimit = Int32.Parse(line.Remove(0, 23)); } else if (line.Contains("Reduce Limit:")) { ResumeSettings.ReduceLimit = Int32.Parse(line.Remove(0, 14)); } } ResumeSettings.SaveSettings(); } WordJumble.Properties.Settings.Default.ModeLastest = true; WordJumble.Properties.Settings.Default.Mode = WordJumble.Properties.Settings.Default.Mode4Resume; WordJumble.Properties.Settings.Default.Save(); }
private void Playing_Load(object sender, EventArgs e) { CheckMode(); QuestionLoading(); if (WordJumble.Properties.Settings.Default.ModeLastest) { ResumeSettings.SetUp(); Bonus = ResumeSettings.Bonus; Point = ResumeSettings.Point; Missed = ResumeSettings.Missed; TotalWin = ResumeSettings.TotalWin; WinTimes = ResumeSettings.WinTimes; progBonus.Value = ResumeSettings.PrepareBonus; HintLimit = ResumeSettings.HintLimit; ChangeQuestionLimit = ResumeSettings.ChangeQuestionLimit; ReduceLimit = ResumeSettings.ReduceLimit; lblMissed.Text = "Missed: " + Missed; lblBonus.Text = "Bonus: " + Bonus; lblPoint.Text = "Point: " + Point; lblWinTimes.Text = "Total Win: " + TotalWin; } progBonus.Maximum = WordJumble.Properties.Settings.Default.WinTimes * 10; }