/// <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 TracingHelper.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); TracingHelper.Error(TracingHelper.TRANSFER_CORRUPTED); } }