コード例 #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);
 }