Пример #1
0
        private void InternalCreateDataTable(DataTableBase dataTable, string text)
        {
            IEnumerable <GameFrameworkSegment <string> > dataRowSegments = null;

            try
            {
                dataRowSegments = m_DataTableHelper.GetDataRowSegments(text);
            }
            catch (Exception exception)
            {
                if (exception is GameFrameworkException)
                {
                    throw;
                }

                throw new GameFrameworkException(Utility.Text.Format("Can not get data row segments with exception '{0}'.", exception.ToString()), exception);
            }

            if (dataRowSegments == null)
            {
                throw new GameFrameworkException("Data row segments is invalid.");
            }

            foreach (GameFrameworkSegment <string> dataRowSegment in dataRowSegments)
            {
                if (!dataTable.AddDataRow(dataRowSegment))
                {
                    throw new GameFrameworkException("Add data row failure.");
                }
            }
        }
        private void InternalCreateDataTable(DataTableBase dataTable, object dataTableData)
        {
            GameFrameworkDataSegment[] dataRowSegments = null;
            object dataTableUserData = null;

            try
            {
                dataRowSegments   = m_DataTableHelper.GetDataRowSegments(dataTableData);
                dataTableUserData = m_DataTableHelper.GetDataTableUserData(dataTableData);
            }
            catch (Exception exception)
            {
                if (exception is GameFrameworkException)
                {
                    throw;
                }

                throw new GameFrameworkException(Utility.Text.Format("Can not get data row segments with exception '{0}'.", exception.ToString()), exception);
            }

            if (dataRowSegments == null)
            {
                throw new GameFrameworkException("Data row segments is invalid.");
            }

            foreach (GameFrameworkDataSegment dataRowSegment in dataRowSegments)
            {
                if (!dataTable.AddDataRow(dataRowSegment, dataTableUserData))
                {
                    throw new GameFrameworkException("Add data row failure.");
                }
            }
        }