Exemplo n.º 1
0
        private void CreateDefaultSchema()
        {
            _schema = new DbcSchema();
            for (int i = 0; i < _table.ColumnCount; i++)
            {
                var col = new DbcColumnSchema()
                {
                    Name = "Column" + i,
                    Position = i,
                    Type = ColumnType.Int32,
                    Width = 100,
                };
                _schema.AddColumn(col);
            }

            BindSchema();
        }
Exemplo n.º 2
0
        private void CreateDefaultSchema()
        {
            _schema = new DbcSchema();
            for (int i = 0; i < _table.ColumnCount; i++)
            {
                var col = new DbcColumnSchema()
                {
                    Name     = "Column" + i,
                    Position = i,
                    Type     = ColumnType.Int32,
                    Width    = 100,
                };
                _schema.AddColumn(col);
            }

            BindSchema();
        }
Exemplo n.º 3
0
        public static DbcSchema Load(Stream source, int specifiedColumns)
        {
            XDocument doc    = XDocument.Load(source);
            DbcSchema result = new DbcSchema();

            foreach (var e in doc.Root.Elements("Column"))
            {
                string     name  = e.Attribute("Name").Value;
                int        pos   = int.Parse(e.Attribute("Position").Value);
                ColumnType type  = (ColumnType)Enum.Parse(typeof(ColumnType), e.Attribute("Type").Value, true);
                int        width = int.Parse(e.Attribute("Width").Value);

                var col = new DbcColumnSchema()
                {
                    Position = pos,
                    Name     = name,
                    Type     = type,
                    Width    = width,
                };
                result.AddColumn(col);
            }

            while (result.ColumnCount > specifiedColumns)
            {
                result._columns.RemoveAt(result.ColumnCount - 1);
            }

            while (result._columns.Count < specifiedColumns)
            {
                var col = new DbcColumnSchema()
                {
                    Position = result.ColumnCount,
                    Name     = "Column" + result.ColumnCount,
                    Type     = ColumnType.Int32,
                    Width    = 100,
                };
                result.AddColumn(col);
            }

            return(result);
        }
Exemplo n.º 4
0
        public static DbcSchema Load(Stream source, int specifiedColumns)
        {
            XDocument doc = XDocument.Load(source);
            DbcSchema result = new DbcSchema();

            foreach (var e in doc.Root.Elements("Column"))
            {
                string name = e.Attribute("Name").Value;
                int pos = int.Parse(e.Attribute("Position").Value);
                ColumnType type = (ColumnType)Enum.Parse(typeof(ColumnType), e.Attribute("Type").Value, true);
                int width = int.Parse(e.Attribute("Width").Value);

                var col = new DbcColumnSchema()
                {
                    Position = pos,
                    Name = name,
                    Type = type,
                    Width = width,
                };
                result.AddColumn(col);
            }

            while (result.ColumnCount > specifiedColumns)
                result._columns.RemoveAt(result.ColumnCount - 1);

            while (result._columns.Count < specifiedColumns)
            {
                var col = new DbcColumnSchema()
                {
                    Position = result.ColumnCount,
                    Name = "Column" + result.ColumnCount,
                    Type = ColumnType.Int32,
                    Width = 100,
                };
                result.AddColumn(col);
            }

            return result;
        }
Exemplo n.º 5
0
 public void AddColumn(DbcColumnSchema column)
 {
     _columns.Add(column);
 }
Exemplo n.º 6
0
 public void AddColumn(DbcColumnSchema column)
 {
     _columns.Add(column);
 }