parse() public méthode

public parse ( string row ) : Transaction
row string
Résultat Transaction
Exemple #1
0
        /// <summary>
        /// CSVデータ読み込み
        /// </summary>
        public override void ReadTransactions()
        {
            skipToFirstLine();

            TransactionList transactions = new TransactionList();
            string          line;
            bool            hasFormatError = false;

            while ((line = mSr.ReadLine()) != null)
            {
                // CSV カラム分割
                string[] row = SplitCsv(line);
                if (row.Length <= 1)
                {
                    continue;                  // ad hoc...
                }
                // パース
                try
                {
                    Transaction t = mRule.parse(row);
                    transactions.Add(t);
                }
                catch (FormatException ex)
                {
                    // ignore transaction

                    // MessageBox.Show(ex.Message, Properties.Resources.Error);
                    hasFormatError = true;
                }
            }

            if (transactions.Count == 0 && hasFormatError)
            {
                // フォーマットエラー例外をスロー
                throw new CsvReadException(Properties.Resources.CsvFormatError);
            }

            // ソート処理
            switch (mRule.sortOrder)
            {
            default:
            case CsvRule.SortOrder.Ascent:
                break;

            case CsvRule.SortOrder.Descent:
                transactions.Reverse();
                break;

            case CsvRule.SortOrder.Auto:
                transactions.list.Sort(compareByDate);
                break;
            }

            mTransactions = transactions;
        }