Esempio n. 1
0
        public DataTableProcessor(ExcelWorksheet excelWorksheet, int nameRow, int typeRow, int defaultValueRow, int commentRow, int contentStartRow, int idColumn)
        {
            this.excelWorksheet = excelWorksheet;

            Guard.Verify <LogicException>(nameRow < 0 || nameRow >= excelWorksheet.Dimension.Rows, string.Format("Name row '{0}' is invalid.", nameRow));
            Guard.Verify <LogicException>(typeRow < 0 || typeRow >= excelWorksheet.Dimension.Rows, string.Format("Type row '{0}' is invalid.", typeRow));
            Guard.Verify <LogicException>(contentStartRow <0 || contentStartRow> excelWorksheet.Dimension.Rows, string.Format("Content start '{0}' is invalid.", contentStartRow));
            Guard.Verify <LogicException>(idColumn < 0 || idColumn >= excelWorksheet.Dimension.Rows, string.Format("Id column '{0}' is invalid.", idColumn));

            this.nameRow         = nameRow;
            this.typeRow         = typeRow;
            this.defaultValueRow = defaultValueRow;
            this.commentRow      = commentRow;
            this.contentStartRow = contentStartRow;
            this.idColumn        = idColumn;

            int rawColumnCount = this.excelWorksheet.Dimension.Columns;

            dataProcessor = new DataProcessor[rawColumnCount];
            for (int i = 0; i < rawColumnCount; i++)
            {
                if (i == IdColumn)
                {
                    dataProcessor[i] = DataProcessorUtility.GetDataProcessor("id");
                }
                else
                {
                    dataProcessor[i] = DataProcessorUtility.GetDataProcessor(excelWorksheet.GetValueEx <string>(typeRow, i));
                }
            }

            // 查找作为Id值注释的列,comment行带@符号
            this.idCommentColumn = idColumn;
            for (int i = 0; i < rawColumnCount; i++)
            {
                if (excelWorksheet.GetValueEx <string>(commentRow, i).IndexOf('@') > -1)
                {
                    idCommentColumn = i;
                    break;
                }
            }

            codeTemplate  = null;
            codeGenerator = null;
        }
Esempio n. 2
0
        public DataTableProcessor(string dataTableFileName, Encoding encoding, int nameRow, int typeRow, int?defaultValueRow, int?commentRow, int contentStartRow, int idColumn)
        {
            if (string.IsNullOrEmpty(dataTableFileName))
            {
                throw new GameFrameworkException("Data table file name is invalid.");
            }

            if (!dataTableFileName.EndsWith(".txt"))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not a txt.", dataTableFileName));
            }

            if (!File.Exists(dataTableFileName))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not exist.", dataTableFileName));
            }

            string[] lines       = File.ReadAllLines(dataTableFileName, encoding);
            int      rawRowCount = lines.Length;

            int             rawColumnCount = 0;
            List <string[]> rawValues      = new List <string[]>();

            for (int i = 0; i < lines.Length; i++)
            {
                string[] rawValue = lines[i].Split(DataSplitSeparators);
                for (int j = 0; j < rawValue.Length; j++)
                {
                    rawValue[j] = rawValue[j].Trim(DataTrimSeparators);
                }

                if (i == 0)
                {
                    rawColumnCount = rawValue.Length;
                }
                else if (rawValue.Length != rawColumnCount)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}', raw Column is '{2}', but line '{1}' column is '{3}'.", dataTableFileName, i.ToString(), rawColumnCount.ToString(), rawValue.Length.ToString()));
                }

                rawValues.Add(rawValue);
            }

            m_RawValues = rawValues.ToArray();

            if (nameRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' is invalid.", nameRow.ToString()));
            }

            if (typeRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' is invalid.", typeRow.ToString()));
            }

            if (contentStartRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' is invalid.", contentStartRow.ToString()));
            }

            if (idColumn < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' is invalid.", idColumn.ToString()));
            }

            if (nameRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' >= raw row count '{1}' is not allow.", nameRow.ToString(), rawRowCount.ToString()));
            }

            if (typeRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' >= raw row count '{1}' is not allow.", typeRow.ToString(), rawRowCount.ToString()));
            }

            if (defaultValueRow.HasValue && defaultValueRow.Value >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Default value row '{0}' >= raw row count '{1}' is not allow.", defaultValueRow.Value.ToString(), rawRowCount.ToString()));
            }

            if (commentRow.HasValue && commentRow.Value >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Comment row '{0}' >= raw row count '{1}' is not allow.", commentRow.Value.ToString(), rawRowCount.ToString()));
            }

            if (contentStartRow > rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' > raw row count '{1}' is not allow.", contentStartRow.ToString(), rawRowCount.ToString()));
            }

            if (idColumn >= rawColumnCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' >= raw column count '{1}' is not allow.", idColumn.ToString(), rawColumnCount.ToString()));
            }

            m_NameRow         = m_RawValues[nameRow];
            m_TypeRow         = m_RawValues[typeRow];
            m_DefaultValueRow = defaultValueRow.HasValue ? m_RawValues[defaultValueRow.Value] : null;
            m_CommentRow      = commentRow.HasValue ? m_RawValues[commentRow.Value] : null;
            m_ContentStartRow = contentStartRow;
            m_IdColumn        = idColumn;

            m_DataProcessor = new DataProcessor[rawColumnCount];
            for (int i = 0; i < rawColumnCount; i++)
            {
                if (i == IdColumn)
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor("id");
                }
                else
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor(m_TypeRow[i]);
                }
            }

            Dictionary <string, int> strings = new Dictionary <string, int>();

            for (int i = contentStartRow; i < rawRowCount; i++)
            {
                if (IsCommentRow(i))
                {
                    continue;
                }

                for (int j = 0; j < rawColumnCount; j++)
                {
                    if (m_DataProcessor[j].LanguageKeyword != "string")
                    {
                        continue;
                    }

                    string str = m_RawValues[i][j];
                    if (strings.ContainsKey(str))
                    {
                        strings[str]++;
                    }
                    else
                    {
                        strings[str] = 1;
                    }
                }
            }

            m_Strings = strings.OrderBy(value => value.Key).OrderByDescending(value => value.Value).Select(value => value.Key).ToArray();

            m_CodeTemplate  = null;
            m_CodeGenerator = null;
        }
        public DataTableProcessor(string dataTableFileName, Encoding encoding)
        {
            if (string.IsNullOrEmpty(dataTableFileName))
            {
                throw new GameFrameworkException("Data table file name is invalid.");
            }

            if (!dataTableFileName.EndsWith(".txt"))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not a txt.", dataTableFileName));
            }

            if (!File.Exists(dataTableFileName))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not exist.", dataTableFileName));
            }

            string[] lines       = File.ReadAllLines(dataTableFileName, encoding);
            int      rawRowCount = lines.Length;

            int             rawColumnCount = 0;
            List <string[]> rawValues      = new List <string[]>();

            for (int i = 0; i < lines.Length; i++)
            {
                string[] rawValue = lines[i].Split(DataSplitSeparators);
                for (int j = 0; j < rawValue.Length; j++)
                {
                    rawValue[j] = rawValue[j].Trim(DataTrimSeparators);
                }

                if (i == 0)
                {
                    rawColumnCount = rawValue.Length;
                }
                else if (rawValue.Length != rawColumnCount)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Raw Column is '{1}', but line '{0}' column is '{2}'.", i.ToString(), rawColumnCount.ToString(), rawValue.Length.ToString()));
                }

                rawValues.Add(rawValue);
            }

            m_RawValues = rawValues.ToArray();

            if (NameRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' is invalid.", NameRow.ToString()));
            }

            if (TypeRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' is invalid.", TypeRow.ToString()));
            }

            if (ContentStartRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' is invalid.", ContentStartRow.ToString()));
            }

            if (IdColumn < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' is invalid.", IdColumn.ToString()));
            }

            if (NameRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' >= raw row count '{1}' is not allow.", NameRow.ToString(), rawRowCount.ToString()));
            }

            if (TypeRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' >= raw row count '{1}' is not allow.", TypeRow.ToString(), rawRowCount.ToString()));
            }

            if (DefaultValueRow != -1 && DefaultValueRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Default value row '{0}' >= raw row count '{1}' is not allow.", DefaultValueRow.ToString(), rawRowCount.ToString()));
            }

            if (CommentRow != -1 && CommentRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Comment row '{0}' >= raw row count '{1}' is not allow.", CommentRow.ToString(), rawRowCount.ToString()));
            }

            if (ContentStartRow > rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' > raw row count '{1}' is not allow.", ContentStartRow.ToString(), rawRowCount.ToString()));
            }

            if (IdColumn >= rawColumnCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' >= raw column count '{1}' is not allow.", IdColumn.ToString(), rawColumnCount.ToString()));
            }

            m_NameRow         = m_RawValues[NameRow];
            m_TypeRow         = m_RawValues[TypeRow];
            m_DefaultValueRow = DefaultValueRow != -1 ? m_RawValues[DefaultValueRow] : null;
            m_CommentRow      = CommentRow != -1 ? m_RawValues[CommentRow] : null;

            m_DataProcessor = new DataProcessor[rawColumnCount];
            for (int i = 0; i < rawColumnCount; i++)
            {
                if (i == IdColumn)
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor("id");
                }
                else
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor(m_TypeRow[i]);
                }
            }

            m_CodeTemplate  = null;
            m_CodeGenerator = null;
        }
        public DataTableProcessor(string dataTableFileName, Encoding encoding, int nameRow, int typeRow, int?defaultValueRow, int?commentRow, int contentStartRow, int idColumn)
        {
            if (string.IsNullOrEmpty(dataTableFileName))
            {
                throw new GameFrameworkException("Data table file name is invalid.");
            }

            if (!dataTableFileName.EndsWith(".txt"))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not a txt.", dataTableFileName));
            }

            if (!File.Exists(dataTableFileName))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not exist.", dataTableFileName));
            }

            string[] lines       = File.ReadAllLines(dataTableFileName, encoding);
            int      rawRowCount = lines.Length;

            int             rawColumnCount = 0;
            List <string[]> rawValues      = new List <string[]>();

            for (int i = 0; i < lines.Length; i++)
            {
                string[] rawValue = lines[i].Split(DataSplitSeparators);
                for (int j = 0; j < rawValue.Length; j++)
                {
                    rawValue[j] = rawValue[j].Trim(DataTrimSeparators);
                }

                if (i == 0)
                {
                    rawColumnCount = rawValue.Length;
                }
                else if (rawValue.Length != rawColumnCount)
                {
                    // print the error row data
                    for (int j = 0; j < rawValue.Length; j++)
                    {
                        Log.Debug("raw " + i.ToString() + "column " + j.ToString() + " " + rawValue[j]);
                    }

                    throw new GameFrameworkException(Utility.Text.Format("Raw Column is '{1}', but line '{0}' column is '{2}'.", i.ToString(), rawColumnCount.ToString(), rawValue.Length.ToString()));
                }

                rawValues.Add(rawValue);
            }

            m_RawValues = rawValues.ToArray();

            if (nameRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' is invalid.", nameRow.ToString()));
            }

            if (typeRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' is invalid.", typeRow.ToString()));
            }

            if (contentStartRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' is invalid.", contentStartRow.ToString()));
            }

            if (idColumn < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' is invalid.", idColumn.ToString()));
            }

            if (nameRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' >= raw row count '{1}' is not allow.", nameRow.ToString(), rawRowCount.ToString()));
            }

            if (typeRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' >= raw row count '{1}' is not allow.", typeRow.ToString(), rawRowCount.ToString()));
            }

            if (defaultValueRow.HasValue && defaultValueRow.Value >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Default value row '{0}' >= raw row count '{1}' is not allow.", defaultValueRow.Value.ToString(), rawRowCount.ToString()));
            }

            if (commentRow.HasValue && commentRow.Value >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Comment row '{0}' >= raw row count '{1}' is not allow.", commentRow.Value.ToString(), rawRowCount.ToString()));
            }

            if (contentStartRow > rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' > raw row count '{1}' is not allow.", contentStartRow.ToString(), rawRowCount.ToString()));
            }

            if (idColumn >= rawColumnCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' >= raw column count '{1}' is not allow.", idColumn.ToString(), rawColumnCount.ToString()));
            }

            m_NameRow         = m_RawValues[nameRow];
            m_TypeRow         = m_RawValues[typeRow];
            m_DefaultValueRow = defaultValueRow.HasValue ? m_RawValues[defaultValueRow.Value] : null;
            m_CommentRow      = commentRow.HasValue ? m_RawValues[commentRow.Value] : null;
            m_ContentStartRow = contentStartRow;
            m_IdColumn        = idColumn;

            m_DataProcessor = new DataProcessor[rawColumnCount];
            for (int i = 0; i < rawColumnCount; i++)
            {
                if (i == IdColumn)
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor("id");
                }
                else
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor(m_TypeRow[i]);
                }
            }

            m_CodeTemplate  = null;
            m_CodeGenerator = null;
        }
Esempio n. 5
0
        /// <summary>
        /// 数据表处理器构造函数
        /// </summary>
        /// <param name="dataTableFilePath">数据表文件路径</param>
        /// <param name="encoding">编码格式</param>
        /// <param name="nameRow">每一列数值命名描述所在行</param>
        /// <param name="typeRow">每一列的数据类型所在行</param>
        /// <param name="defaultValueRow">默认值所在行</param>
        /// <param name="commentRow">每列数值的注释行</param>
        /// <param name="contentStartRow">数据内容开始行</param>
        /// <param name="idColumn">id所在列</param>
        public DataTableProcessor(string dataTableFilePath, Encoding encoding, int nameRow, int typeRow, int?defaultValueRow, int?commentRow, int contentStartRow, int idColumn)
        {
            if (string.IsNullOrEmpty(dataTableFilePath))
            {
                throw new GameFrameworkException("Data table file name is invalid.");
            }

            if (!dataTableFilePath.EndsWith(".csv"))    //只能处理txt文件
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not a txt.", dataTableFilePath));
            }

            if (!File.Exists(dataTableFilePath))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not exist.", dataTableFilePath));
            }

            string[] lines       = File.ReadAllLines(dataTableFilePath, encoding); //读取所有行内容
            int      rawRowCount = lines.Length;                                   //行数

            int             rawColumnCount = 0;                                    //列数
            List <string[]> rawValues      = new List <string[]>();                //所有行的内容

            for (int i = 0; i < lines.Length; i++)
            {
                string[] rawValue = lines[i].Split(DataSplitSeparators);    //其中一行内容
                for (int j = 0; j < rawValue.Length; j++)
                {
                    rawValue[j] = rawValue[j].Trim(DataTrimSeparators); //去除引号
                }

                if (i == 0)                           //第一列肯定是#
                {
                    rawColumnCount = rawValue.Length; //列数
                }
                else if (rawValue.Length != rawColumnCount)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Raw Column is '{1}', but line '{0}' column is '{2}'.", i.ToString(), rawColumnCount.ToString(), rawValue.Length.ToString()));
                }

                rawValues.Add(rawValue);    //保存所有行的内容
            }

            m_RawValues = rawValues.ToArray();  //行列值的二维数组
            //Debug.Log(Utility.Text.Format("{0}文件的行数:{1}", dataTableFilePath, m_RawValues.Length));

            //检查行参数是否越界
            if (nameRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' is invalid.", nameRow.ToString()));
            }
            if (typeRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' is invalid.", typeRow.ToString()));
            }
            if (contentStartRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' is invalid.", contentStartRow.ToString()));
            }
            if (idColumn < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' is invalid.", idColumn.ToString()));
            }
            if (nameRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' >= raw row count '{1}' is not allow.", nameRow.ToString(), rawRowCount.ToString()));
            }
            if (typeRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' >= raw row count '{1}' is not allow.", typeRow.ToString(), rawRowCount.ToString()));
            }
            if (defaultValueRow.HasValue && defaultValueRow.Value >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Default value row '{0}' >= raw row count '{1}' is not allow.", defaultValueRow.Value.ToString(), rawRowCount.ToString()));
            }
            if (commentRow.HasValue && commentRow.Value >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Comment row '{0}' >= raw row count '{1}' is not allow.", commentRow.Value.ToString(), rawRowCount.ToString()));
            }
            if (contentStartRow > rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' > raw row count '{1}' is not allow.", contentStartRow.ToString(), rawRowCount.ToString()));
            }
            if (idColumn >= rawColumnCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' >= raw column count '{1}' is not allow.", idColumn.ToString(), rawColumnCount.ToString()));
            }

            //获取数据
            m_NameRow         = m_RawValues[nameRow];
            m_TypeRow         = m_RawValues[typeRow];
            m_DefaultValueRow = defaultValueRow.HasValue ? m_RawValues[defaultValueRow.Value] : null;
            m_CommentRow      = commentRow.HasValue ? m_RawValues[commentRow.Value] : null;
            ContentStartRow   = contentStartRow; //保存内容开始的行
            IdColumn          = idColumn;        //保存id所在的列

            m_DataProcessor = new DataProcessor[rawColumnCount];
            for (int i = 0; i < rawColumnCount; i++)
            {
                if (i == IdColumn)
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor("id");   //获取id的数据处理器
                }
                else
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor(m_TypeRow[i]);   //获取其他类型的
                }
            }

            m_CodeTemplate  = null;
            m_CodeGenerator = null;
        }
Esempio n. 6
0
        public DataTableProcessor(string dataTableFileName, Encoding encoding, int nameRow, int typeRow, int?defaultValueRow, int?commentRow, int contentStartRow, int idColumn)
        {
            if (string.IsNullOrEmpty(dataTableFileName))
            {
                throw new GameFrameworkException("Data table file name is invalid.");
            }

            if (!dataTableFileName.EndsWith(".txt", StringComparison.Ordinal) && !dataTableFileName.EndsWith(".xlsx", StringComparison.Ordinal))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not a txt or xlsx.", dataTableFileName));
            }

            if (!File.Exists(dataTableFileName))
            {
                throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not exist.", dataTableFileName));
            }

            int             tempRawColumnCount = 0;
            List <string[]> rawValues          = new List <string[]>();

            if (dataTableFileName.EndsWith(".txt", StringComparison.Ordinal))
            {
                string[] lines = File.ReadAllLines(dataTableFileName, encoding);

                for (int i = 0; i < lines.Length; i++)
                {
                    string[] rawValue = lines[i].Split(DataSplitSeparators);
                    for (int j = 0; j < rawValue.Length; j++)
                    {
                        rawValue[j] = rawValue[j].Trim(DataTrimSeparators);
                    }

                    if (i == 0)
                    {
                        tempRawColumnCount = rawValue.Length;
                    }
                    else if (rawValue.Length != tempRawColumnCount)
                    {
                        throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}', raw Column is '{2}', but line '{1}' column is '{3}'.", dataTableFileName, i.ToString(), tempRawColumnCount.ToString(), rawValue.Length.ToString()));
                    }

                    rawValues.Add(rawValue);
                }
            }
            else
            {
                XSSFWorkbook xssfWorkbook;
                using (FileStream file = new FileStream(dataTableFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    xssfWorkbook = new XSSFWorkbook(file);
                }

                int    maxCellNum = 0;
                ISheet sheet      = xssfWorkbook.GetSheetAt(0);
                for (int i = 0; i <= sheet.LastRowNum; i++)
                {
                    IRow row = sheet.GetRow(i);
                    for (int j = 0; j < row.LastCellNum; j++)
                    {
                        maxCellNum = Mathf.Max(maxCellNum, row.LastCellNum);
                    }
                }

                for (int i = 0; i <= sheet.LastRowNum; i++)
                {
                    List <string> lines = new List <string>();

                    IRow row = sheet.GetRow(i);

                    for (int j = 0; j < maxCellNum; j++)
                    {
                        ICell cell = row.GetCell(j);
                        if (cell != null)
                        {
                            lines.Add(cell.ToString().Trim(DataTrimSeparators));
                        }
                        else
                        {
                            lines.Add("");
                        }
                    }
                    rawValues.Add(lines.ToArray());
                }
            }
            m_RawValues = rawValues.ToArray();
            int rawRowCount    = m_RawValues.Length;
            int rawColumnCount = m_RawValues[0].Length;

            if (nameRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' is invalid.", nameRow.ToString()));
            }

            if (typeRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' is invalid.", typeRow.ToString()));
            }

            if (contentStartRow < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' is invalid.", contentStartRow.ToString()));
            }

            if (idColumn < 0)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' is invalid.", idColumn.ToString()));
            }

            if (nameRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' >= raw row count '{1}' is not allow.", nameRow.ToString(), rawRowCount.ToString()));
            }

            if (typeRow >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' >= raw row count '{1}' is not allow.", typeRow.ToString(), rawRowCount.ToString()));
            }

            if (defaultValueRow.HasValue && defaultValueRow.Value >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Default value row '{0}' >= raw row count '{1}' is not allow.", defaultValueRow.Value.ToString(), rawRowCount.ToString()));
            }

            if (commentRow.HasValue && commentRow.Value >= rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Comment row '{0}' >= raw row count '{1}' is not allow.", commentRow.Value.ToString(), rawRowCount.ToString()));
            }

            if (contentStartRow > rawRowCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' > raw row count '{1}' is not allow.", contentStartRow.ToString(), rawRowCount.ToString()));
            }

            if (idColumn >= rawColumnCount)
            {
                throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' >= raw column count '{1}' is not allow.", idColumn.ToString(), rawColumnCount.ToString()));
            }

            m_NameRow         = m_RawValues[nameRow];
            m_TypeRow         = m_RawValues[typeRow];
            m_DefaultValueRow = defaultValueRow.HasValue ? m_RawValues[defaultValueRow.Value] : null;
            m_CommentRow      = commentRow.HasValue ? m_RawValues[commentRow.Value] : null;
            m_ContentStartRow = contentStartRow;
            m_IdColumn        = idColumn;

            m_DataProcessor = new DataProcessor[rawColumnCount];
            for (int i = 0; i < rawColumnCount; i++)
            {
                if (i == IdColumn)
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor("id");
                }
                else
                {
                    m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor(m_TypeRow[i]);
                }
            }

            Dictionary <string, int> strings = new Dictionary <string, int>(StringComparer.Ordinal);

            for (int i = contentStartRow; i < rawRowCount; i++)
            {
                if (IsCommentRow(i))
                {
                    continue;
                }

                for (int j = 0; j < rawColumnCount; j++)
                {
                    if (m_DataProcessor[j].LanguageKeyword != "string")
                    {
                        continue;
                    }

                    string str = m_RawValues[i][j];
                    if (strings.ContainsKey(str))
                    {
                        strings[str]++;
                    }
                    else
                    {
                        strings[str] = 1;
                    }
                }
            }

            m_Strings = strings.OrderBy(value => value.Key).OrderByDescending(value => value.Value).Select(value => value.Key).ToArray();

            m_CodeTemplate  = null;
            m_CodeGenerator = null;
        }