예제 #1
0
        public void SaveScore(int score, int level, string name)
        {
            if (score < 80)
            {
                return;
            }
            if (Constant.DefaultTxtBoxName.Equals(name))
            {
                name = Constant.DefaultName;
            }

            RecordDS recordDS = (RecordDS)ReadRecord();

            recordDS.RecordDT.AddRecordDTRow(
                score, level, name,
                System.DateTime.Now, level * score, 0);

            if (recordDS.RecordDT.Rows.Count > 10)
            {
                DataRow[] drs = Sort(recordDS);
                recordDS.RecordDT.Rows.Remove(drs[0]);
            }

            recordDS.WriteXml(recordFileName);
        }
예제 #2
0
        private RecordDS ReadXml()
        {
            RecordDS recordDS = new RecordDS();

            if (File.Exists(recordFileName))
            {
                recordDS.ReadXml(recordFileName);
            }
            return(recordDS);
        }
예제 #3
0
        public DataRow[] GetRecord()
        {
            RecordDS recordDS = ReadXml();

            DataRow[] drs = Sort(recordDS);
            for (int i = 0; i < drs.Length; i++)
            {
                drs[i]["No"] = i + 1;
            }
            return(drs);
        }
예제 #4
0
 private static DataRow[] Sort(RecordDS recordDS)
 {
     DataRow[] drs = recordDS.RecordDT.Select("", "TatolScore DESC");
     return(drs);
 }