12 |
uint CurrentAddress(); |
uint CurrentAddress(); |
13 |
void CurrentResult<TValue>(out TValue Value); |
void CurrentResult<TValue>(out TValue Value); |
14 |
TValue CurrentResult<TValue>(); |
TValue CurrentResult<TValue>(); |
15 |
|
|
16 |
|
bool ReadCurrentAddess { get; } |
17 |
|
bool ReadCurrentValue { get; } |
18 |
|
|
19 |
} |
} |
20 |
public class SearchResultReader : SerializationReader, ISearchResultReader |
public class SearchResultReader : SerializationReader, ISearchResultReader |
21 |
{ |
{ |
48 |
} |
} |
49 |
catch (System.IO.EndOfStreamException) { } |
catch (System.IO.EndOfStreamException) { } |
50 |
} |
} |
51 |
#region ISearchResultReader members |
#region ISearchResultReader members |
52 |
|
public bool ReadCurrentAddess { get; private set; } |
53 |
|
public bool ReadCurrentValue { get; private set; } |
54 |
public uint CurrentAddress() |
public uint CurrentAddress() |
55 |
{ |
{ |
56 |
uint Address = 0; |
uint Address = 0; |
62 |
Address = 0; |
Address = 0; |
63 |
try |
try |
64 |
{ |
{ |
65 |
|
if (ReadCurrentAddess && !ReadCurrentValue) |
66 |
|
{ |
67 |
|
throw new InvalidOperationException("Cannot read Current Address because the current Value has not been read. Please call CurrentResult<TValue>() first."); |
68 |
|
} |
69 |
Address = binReader.ReadUInt32(); |
Address = binReader.ReadUInt32(); |
70 |
|
ReadCurrentAddess = true; |
71 |
|
ReadCurrentValue = false; |
72 |
} |
} |
73 |
catch (System.IO.EndOfStreamException) { } |
catch (System.IO.EndOfStreamException) { } |
74 |
} |
} |
81 |
public void CurrentResult<TValue>(out TValue Value) |
public void CurrentResult<TValue>(out TValue Value) |
82 |
{ |
{ |
83 |
Value = default(TValue); |
Value = default(TValue); |
84 |
|
if (!ReadCurrentAddess) |
85 |
|
{ |
86 |
|
throw new InvalidOperationException("Cannot read Current Value because the current Address has not been read. Please call CurrentAddress() first."); |
87 |
|
} |
88 |
try |
try |
89 |
{ |
{ |
90 |
Type t = typeof(TValue); |
Type t = typeof(TValue); |
115 |
Value = (TValue)Convert.ChangeType(binReader.ReadInt64(), typeof(TValue)); |
Value = (TValue)Convert.ChangeType(binReader.ReadInt64(), typeof(TValue)); |
116 |
break; |
break; |
117 |
} |
} |
118 |
|
ReadCurrentValue = true; |
119 |
|
ReadCurrentAddess = false; |
120 |
} |
} |
121 |
catch (System.IO.EndOfStreamException) { } |
catch (System.IO.EndOfStreamException) { } |
122 |
} |
} |