Esempio n. 1
0
        public void Refresh()
        {
            StreamWriter file;
            string       path = @"../../Resources/scores.txt";

            if (File.Exists(path))
            {
                file = new StreamWriter(path);
                for (int i = 0; i < Results.Count; i++)
                {
                    string[] s = Results[i].Split('\t');
                    s[0] = Coding.EncryptString(s[0]);
                    s[1] = Coding.EncryptString(s[1]);
                    file.WriteLine(s[0] + "\t" + s[1]);
                }
                file.Close();
            }
        }
Esempio n. 2
0
        public Scores()
        {
            StreamReader file;

            Results = new List <string>();
            string path = @"../../Resources/scores.txt";

            if (File.Exists(path))
            {
                file = new StreamReader(path);
                string lines;
                while ((lines = file.ReadLine()) != null)
                {
                    string[] parts = lines.Split('\t');
                    parts[0] = Coding.DecryptString(parts[0]);
                    parts[1] = Coding.DecryptString(parts[1]);
                    Results.Add(parts[0] + "\t" + parts[1]);
                }
                file.Close();
            }
            updateLowest();
        }
Esempio n. 3
0
        public Data()
        {
            Easy   = new List <string>();
            Normal = new List <string>();
            Hard   = new List <string>();
            bool         easy   = false;
            bool         normal = false;
            bool         hard   = false;
            StreamReader file;
            string       path = @"../../Resources/words.txt";

            if (File.Exists(path))
            {
                file = new StreamReader(path);
                string lines;
                bool   flag = false;
                while ((lines = file.ReadLine()) != null)
                {
                    lines = Coding.DecryptString(lines.TrimEnd('\n', '\r'));
                    if (lines.StartsWith("*") && lines.EndsWith("*"))
                    {
                        if (lines.ToLower().Equals(string.Format("*easy*")))
                        {
                            easy   = true;
                            normal = false;
                            hard   = false;
                            flag   = true;
                        }
                        else if (lines.ToLower().Equals(string.Format("*normal*")))
                        {
                            easy   = false;
                            normal = true;
                            hard   = false;
                            flag   = true;
                        }
                        else if (lines.ToLower().Equals(string.Format("*hard*")))
                        {
                            easy   = false;
                            normal = false;
                            hard   = true;
                            flag   = true;
                        }
                    }
                    else
                    {
                        flag = false;
                    }
                    if (!flag && lines.Length > 0)
                    {
                        if (easy)
                        {
                            Easy.Add(lines);
                        }
                        if (normal)
                        {
                            Normal.Add(lines);
                        }
                        if (hard)
                        {
                            Hard.Add(lines);
                        }
                    }
                }
                file.Close();
            }
        }