Esempio n. 1
0
        public override PlaylogRecordTable CreateJsonData(IPlaylogRecordTable <IPlaylogRecordTableUnit> data)
        {
            var jsonObject = new PlaylogRecordTable();

            foreach (var unit in data.GetTableUnits())
            {
                var recordUnit = new PlaylogRecordTableUnit();
                recordUnit.Set(unit);
                jsonObject.TableUnits.Add(recordUnit);
            }

            return(jsonObject);
        }
Esempio n. 2
0
        private PlaylogRecordTableUnit CreatePlaylogRecord(Dictionary <Header.Parameter, Header.Column> header, IXLRow row)
        {
            var playlogRecord = new PlaylogRecordTableUnit();

            playlogRecord.Id          = row.Cell(header[Header.Parameter.Id].Index).GetValue <int>();
            playlogRecord.Name        = row.Cell(header[Header.Parameter.Name].Index).GetValue <string>();
            playlogRecord.Genre       = row.Cell(header[Header.Parameter.Genre].Index).GetValue <string>();
            playlogRecord.Difficulty  = Utility.ToDifficulty(row.Cell(header[Header.Parameter.Difficulty].Index).GetValue <string>());
            playlogRecord.Score       = row.Cell(header[Header.Parameter.Score].Index).GetValue <int>();
            playlogRecord.Rank        = Utility.ToRank(row.Cell(header[Header.Parameter.Rank].Index).GetValue <string>());
            playlogRecord.BaseRating  = row.Cell(header[Header.Parameter.BaseRating].Index).GetValue <double>();
            playlogRecord.Rating      = row.Cell(header[Header.Parameter.Rating].Index).GetValue <double>();
            playlogRecord.IsNewRecord = row.Cell(header[Header.Parameter.IsNewRecord].Index).GetValue <bool>();
            playlogRecord.IsClear     = row.Cell(header[Header.Parameter.IsClear].Index).GetValue <bool>();
            playlogRecord.ComboStatus = (ComboStatus)Enum.Parse(typeof(ComboStatus), row.Cell(header[Header.Parameter.ComboStatus].Index).GetValue <string>());
            playlogRecord.ChainStatus = (ChainStatus)Enum.Parse(typeof(ChainStatus), row.Cell(header[Header.Parameter.ChainStatus].Index).GetValue <string>());
            playlogRecord.Track       = row.Cell(header[Header.Parameter.Track].Index).GetValue <int>();
            playlogRecord.PlayDate    = row.Cell(header[Header.Parameter.PlayDate].Index).GetValue <DateTime>();

            return(playlogRecord);
        }
Esempio n. 3
0
        private PlaylogRecordTableUnit ParseRow(string row)
        {
            var unit = new PlaylogRecordTableUnit();

            var index = 0;

            unit.Id          = GetField(row, ref index, int.Parse);
            unit.Name        = GetTextField(row, ref index);
            unit.Genre       = GetTextField(row, ref index);
            unit.Difficulty  = Utility.ToDifficulty(GetTextField(row, ref index));
            unit.Score       = GetField(row, ref index, int.Parse);
            unit.Rank        = Utility.ToRank(GetTextField(row, ref index));
            unit.BaseRating  = GetField(row, ref index, double.Parse);
            unit.Rating      = GetField(row, ref index, double.Parse);
            unit.IsNewRecord = GetField(row, ref index, bool.Parse);
            unit.IsClear     = GetField(row, ref index, bool.Parse);
            unit.ComboStatus = Utility.ToComboStatus(GetTextField(row, ref index));
            unit.ChainStatus = Utility.ToChainStatus(GetTextField(row, ref index));
            unit.Track       = GetField(row, ref index, int.Parse);
            unit.PlayDate    = DateTime.Parse(GetTextField(row, ref index));

            return(unit);
        }