public void SuccCheck() { foreach (Status statusC in status) { if (statusC != Status.MATCH) { return; } } string path = ""; if (levelTag == 1) { path = Application.StartupPath + @"\ranking.txt"; } else if (levelTag == 2) { path = Application.StartupPath + @"\ranking1.txt"; } System.IO.FileInfo fl = new FileInfo(path); if (!fl.Exists) { File.Create(path); StreamWriter sw = new StreamWriter(path); sw.WriteLine(score); sw.Close(); } else { StreamWriter sw = new StreamWriter(path, true); sw.WriteLine(score); sw.Close(); } WinForm win = new WinForm(levelTag, score, 1, 0); win.ShowDialog(); this.Close(); }