예제 #1
0
        void ReadRecords()
        {
            records = new record[10];
            StreamReader reader = new StreamReader("TableScore.txt");

            try
            {
                string[] fileData = reader.ReadToEnd().Split('\n');
                for (int i = 0; i < 19; i += 2)
                {
                    records[i / 2] = new record(Convert.ToInt32(fileData[i]), fileData[i + 1]);
                }
            }
            catch
            {
                for (int i = 0; i < 10; i++)
                {
                    records[i] = new record(0, "змейка");
                }
            }
            finally
            {
                reader.Close();
            }
        }
예제 #2
0
        void NewRecord()
        {
            int indexInTable = 10;

            for (int i = 9; i > -1; i--)
            {
                if (score > records[i].score)
                {
                    indexInTable = i;
                }
            }
            for (int i = 9; i > indexInTable; i--)
            {
                records[i] = records[i - 1];
            }
            records[indexInTable] = new record(score, "Неизвестная змейка");
            recordForm            = new newRecordForm(this, indexInTable);
            recordForm.ShowDialog();
        }