コード例 #1
0
        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);
        }
コード例 #2
0
        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));
                    }
                }
            }
        }
コード例 #3
0
        public void SaveCheatFile(string fileName)
        {
            //if (ContCheat != null) ContCheat.Clear();
            //ContCheat = new StringBuilder();
            //ContCheat.Append(CheatContRTB.Text);

            /*using (FileStream fStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write))
             * {
             *  using (TextWriter textW = new StringWriter(ContCheat))
             *      {
             *      textW.Write(CheatContRTB);
             *      //CheatContRTB.Text = ContCheat.ToString();//AppendText(String.Format("{0}\n", curStr));
             *
             *      }
             *
             *  }*/
            //File.WriteAllText(fileName, CheatContRTB.Text, Encoding.Default);
            CheatContRTB.SaveFile(fileName, RichTextBoxStreamType.PlainText);
        }