8 |
|
{ |
9 |
|
public abstract class SerializationReader : ISerializationResultCount, IDisposable |
10 |
|
{ |
11 |
+ |
private static string CreateFilename(Guid guid) |
12 |
+ |
{ |
13 |
+ |
if (guid == Guid.Empty) |
14 |
+ |
{ |
15 |
+ |
return DEFAULT_PATH; |
16 |
+ |
} |
17 |
+ |
else |
18 |
+ |
{ |
19 |
+ |
return string.Format(@"{0}\{1}", DEFAULT_FOLDER, string.Format("{0}.tmp", guid.ToString())); |
20 |
+ |
} |
21 |
+ |
} |
22 |
|
private const string DEFAULT_FOLDER = "tmp"; |
23 |
|
private const string DEFAULT_FILENAME = "SerializedMemoryResults.tmp"; |
24 |
|
private static string DEFAULT_PATH = string.Format(@"{0}\{1}", DEFAULT_FOLDER, DEFAULT_FILENAME); |
25 |
< |
public SerializationReader() : this(DEFAULT_PATH) { } |
26 |
< |
protected SerializationReader(string filename) { FileName = filename; CreateReader(); } |
25 |
> |
//public SerializationReader() : this(CreateFilename(Guid.Empty)) { CreateReader(Guid.Empty); } |
26 |
> |
public SerializationReader(Guid guid) : this(CreateFilename(guid)) { CreateReader(guid); } |
27 |
> |
protected SerializationReader(string filename) { FileName = filename; } |
28 |
|
|
29 |
+ |
|
30 |
|
|
31 |
|
#region ISerializationResultCount members |
32 |
|
public int ResultCount { get; protected set; } |
34 |
|
private FileStream fileStream; |
35 |
|
protected BinaryReader binReader; |
36 |
|
protected string FileName { get; private set; } |
37 |
< |
private void CreateReader() |
37 |
> |
private void CreateReader(Guid guid) |
38 |
|
{ |
39 |
|
fileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); |
40 |
|
binReader = new BinaryReader(fileStream); |