コード例 #1
0
        public int GetArraySizeAt(CSVRow row, int columnIdx)
        {
            if (this.m_rowList.Size() > 0)
            {
                int rowIdx = this.m_rowList.IndexOf(row);

                if (rowIdx != -1)
                {
                    CSVColumn column = this.m_columnList[columnIdx];
                    return(column.GetArraySize(this.m_rowList[rowIdx].GetRowOffset(),
                                               rowIdx + 1 >= this.m_rowList.Size() ? column.GetSize() : this.m_rowList[rowIdx + 1].GetRowOffset()));
                }
            }

            return(0);
        }
コード例 #2
0
        public void AddAndConvertValue(string value, int columnIndex)
        {
            CSVColumn column = this.m_columnList[columnIndex];

            if (!string.IsNullOrEmpty(value))
            {
                switch (column.GetColumnType())
                {
                case -1:
                case 0:
                    column.AddStringValue(value);
                    break;

                case 1:
                    column.AddIntegerValue(int.Parse(value));
                    break;

                case 2:
                    if (bool.TryParse(value, out bool booleanValue))
                    {
                        column.AddBooleanValue(booleanValue);
                    }
                    else
                    {
                        Debugger.Warning(string.Format("CSVTable::addAndConvertValue invalid value '{0}' in Boolean column '{1}', {2}", value,
                                                       this.m_columnNameList[columnIndex], this.GetFileName()));
                        column.AddBooleanValue(false);
                    }

                    break;
                }
            }
            else
            {
                column.AddEmptyValue();
            }
        }