Esempio n. 1
0
        public void LoadData()
        {
            string[] strArray = File.ReadAllLines("Score.dat", Encoding.Default);
            strArray[0] = Encryption.Decrypt(strArray[0]);
            strArray[0] = strArray[0].Replace("\r\n", "\n");
            string[] stringList = strArray[0].Split('\n');
            int      i          = 0;

            PlayerName = stringList[i++];
            SC_History.ForEach(x => x.String2Data(stringList[i++]));
            S_History.ForEach(x => x.String2Data(stringList[i++]));
            C_History.ForEach(x => x.String2Data(stringList[i++]));
            CheckEnable();
        }
Esempio n. 2
0
        public void SaveData()
        {
            ScoreFile = new FileStream("Score.dat", FileMode.Create);
            string tmp = null;

            tmp = tmp + PlayerName + "\r\n";
            SC_History.ForEach(x => tmp += x.Data2String());
            S_History.ForEach(x => tmp  += x.Data2String());
            C_History.ForEach(x => tmp  += x.Data2String());
            tmp = Encryption.Encrypt(tmp);
            StreamWriter streamWriter = new StreamWriter(ScoreFile);

            streamWriter.Write(tmp);
            streamWriter.Close();
        }