예제 #1
0
        /// <summary>
        /// DataTable拆包
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public unsafe static DataTable Get(dataTable value)
        {
            if (value == null)
            {
                return(null);
            }
            DataTable table = new DataTable(value.name);

            try
            {
                if (value.rowCount != 0)
                {
                    fixed(byte *dataFixed = value.data.Data)
                    {
                        dataReader builder = new dataReader(dataFixed, value.data.Strings, value.data.Bytes);

                        value.get(table, builder);
                    }
                }
                return(table);
            }
            catch (Exception error)
            {
                table.Dispose();
                log.Error.Add(error, null, false);
            }
            return(null);
        }
예제 #2
0
        /// <summary>
        /// DataTable包装
        /// </summary>
        /// <param name="table"></param>
        /// <param name="builder">数据流包装器</param>
        /// <returns></returns>
        internal static dataTable From(DataTable table, dataWriter builder)
        {
            dataTable value = new dataTable();

            if ((value.rowCount = table.Rows.Count) != 0)
            {
                value.from(table, builder);
            }
            value.name = table.TableName;
            return(value);
        }
예제 #3
0
        /// <summary>
        /// DataTable包装
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public static dataTable From(DataTable table)
        {
            if (table == null)
            {
                return(null);
            }
            dataTable value = new dataTable();

            if ((value.rowCount = table.Rows.Count) != 0)
            {
                using (dataWriter builder = new dataWriter())
                {
                    value.from(table, builder);
                    value.data = builder.Get();
                }
            }
            return(value);
        }
예제 #4
0
        public static DataTable DeSerialize(byte[] data)
        {
            dataTable value = fastCSharp.emit.dataDeSerializer.DeSerialize <dataTable>(data);

            return(value != null?Get(value) : null);
        }