internal Row(Table t, BinaryReader din, int pos, Row before) { tTable = t; int index = tTable.IndexCount; Pos = pos; nFirstIndex = new Node(this, din, 0); Node n = nFirstIndex; for (int i = 1; i < index; i++) { n.nNext = new Node(this, din, i); n = n.nNext; } int l = tTable.InternalColumnCount; oData = Column.ReadData(din, l); int iCurrent = din.ReadInt32(); LogHelper.Publish(String.Format("Row read with {0} columns. Row read position from file: {1}. Current position: {2}.", oData.Length, iCurrent, Pos), LogHelper.LogEntryType.Debug); Trace.Check(iCurrent == Pos, Trace.INPUTSTREAM_ERROR); Insert(before); LastAccess = CurrentAccess++; }
/// <summary> /// Constructor for a result based on a byte stream. /// </summary> /// <param name="b"></param> internal Result(byte[] b) { MemoryStream bin = new MemoryStream(b); BinaryReader din = new BinaryReader(bin); try { #if !POCKETPC _mode = (ResultType)Enum.Parse(typeof(ResultType), din.ReadInt32().ToString()); #else _mode = (ResultType)OpenNETCF.EnumEx.Parse(typeof(ResultType), din.ReadInt32().ToString()); #endif if (_mode == ResultType.Error) { throw Trace.GetError(din.ReadString()); } else if (_mode == ResultType.UpdateCount) { _updateCount = din.ReadInt32(); } else if (_mode == ResultType.Data) { int l = din.ReadInt32(); PrepareData(l); _columnCount = l; for (int i = 0; i < l; i++) { #if !POCKETPC Type[i] = (ColumnType)Enum.Parse(typeof(ColumnType), din.ReadInt32().ToString()); #else Type[i] = (ColumnType)OpenNETCF.EnumEx.Parse(typeof(ColumnType), din.ReadInt32().ToString()); #endif Label[i] = din.ReadString(); Table[i] = din.ReadString(); Name[i] = din.ReadString(); } while (din.PeekChar() != -1) { Add(Column.ReadData(din, l)); } } } catch (Exception e) { LogHelper.Publish("Unexpected error on Result.", e); Trace.Error(Trace.TRANSFER_CORRUPTED); } }