public string BrowseLCheat() { BrowseCheat(); if (File.Exists(CheatFileName)) { if (ContCheat != null) { ContCheat = null; } ContCheat = new StringBuilder(); CheatContRTB.Clear(); using (FileStream fStream = new FileStream(CheatFileName, FileMode.Open, FileAccess.Read)) { using (TextReader textR = new StreamReader(fStream, Encoding.Default)) { string curStr = textR.ReadLine(); while (curStr != null) { curStr = textR.ReadLine(); ContCheat.AppendLine(curStr); } CheatContRTB.Text = ContCheat.ToString();//AppendText(String.Format("{0}\n", curStr)); } } } return(CheatFileName = BrowseCFD.SafeFileName); //return CheatFileName = Path.Combine(dirInfo.FullName, BrowseCFD.FileName); }
public void ShowCheat() { try { if (GameLB.SelectedItem != null) { GameLB.SelectedItem = 0; } SelectGameName = GameLB.SelectedItem.ToString(); } catch (NullReferenceException ex) { GameLB.SelectedItem = 0; } var req = from cheat in Cheats where cheat.GameName == SelectGameName select cheat; //select cheat.FileName; string FName = ""; foreach (var cheat in req) { CheatFileName = cheat.FileName; GameNameTB.Text = cheat.GameName; TestLabel2.Text = CheatFileName; GLabel.Text = GenreCB.Items[cheat.Genre].ToString(); //MessageBox.Show(CheatFileName); } if (File.Exists(CheatFileName)) { //if (ContCheat != null) ContCheat = null; ContCheat = new StringBuilder(); CheatContRTB.Clear(); using (FileStream fStream = new FileStream(CheatFileName, FileMode.Open, FileAccess.Read)) { using (TextReader textR = new StreamReader(fStream, Encoding.Default)) { string curStr = textR.ReadLine(); ContCheat.AppendLine(curStr); while (curStr != null) { curStr = textR.ReadLine(); ContCheat.AppendLine(curStr); } CheatContRTB.Text = ContCheat.ToString(); //AppendText(String.Format("{0}\n", curStr)); } } } }