コード例 #1
0
        private void EndGame()
        {
            string now    = DateTime.Now.ToString("dd/MM/yy H:mm:ss");
            Info   person = new Info(Gameplay.Username, Gameplay.UserScore, Gameplay.Level, now);

            if (File.Exists("persons.xml"))
            {
                string input    = WorkWithFile.SimpleRead1();
                string inputxml = WorkWithFile.Decrypt(input, "HelloWorld");
                WorkWithFile.SimpleWrite1(inputxml);
            }

            Info[] from    = WorkWithFile.SimpleRead();
            Info[] persons = { person };
            if (from[0] != null)
            {
                persons = new Info[from.Length + 1];
                for (int i = 0; i < persons.Length - 1; i++)
                {
                    persons[i] = from[i];
                }
                persons[persons.Length - 1] = person;
            }

            WorkWithFile.SimpleWrite(persons);
            string output    = WorkWithFile.SimpleRead1();
            string outputxml = WorkWithFile.Encrypt(output, "HelloWorld");

            WorkWithFile.SimpleWrite1(outputxml);

            var w1 = new ResultTable();

            w1.Show();
            Close();
        }
コード例 #2
0
        public void StartTable()
        {
            string input    = WorkWithFile.SimpleRead1();
            string inputxml = WorkWithFile.Decrypt(input, "HelloWorld");

            WorkWithFile.SimpleWrite1(inputxml);

            Info[] from = WorkWithFile.SimpleRead();


            string output    = WorkWithFile.SimpleRead1();
            string outputxml = WorkWithFile.Encrypt(output, "HelloWorld");

            WorkWithFile.SimpleWrite1(outputxml);

            List <Info> ListToShow = new List <Info>();

            for (int i = 0; i < from.Length; i++)
            {
                ListToShow.Add(from[i]);
            }
            ResultDataGrid.ItemsSource = ListToShow;

            // show it
        }