/[RomCheater]/trunk/RomCheater/Serialization/SerializationReader.cs
ViewVC logotype

Diff of /trunk/RomCheater/Serialization/SerializationReader.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 402 by william, Thu Jun 21 06:30:33 2012 UTC revision 444 by william, Sun Jun 2 18:56:41 2013 UTC
# Line 8  namespace RomCheater.Serialization Line 8  namespace RomCheater.Serialization
8  {  {
9      public abstract class SerializationReader : ISerializationResultCount, IDisposable      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";          private const string DEFAULT_FOLDER = "tmp";
23          private const string DEFAULT_FILENAME = "SerializedMemoryResults.tmp";          private const string DEFAULT_FILENAME = "SerializedMemoryResults.tmp";
24          private static string DEFAULT_PATH = string.Format(@"{0}\{1}", DEFAULT_FOLDER, DEFAULT_FILENAME);          private static string DEFAULT_PATH = string.Format(@"{0}\{1}", DEFAULT_FOLDER, DEFAULT_FILENAME);
25          public SerializationReader() : this(DEFAULT_PATH) { }          //public SerializationReader() : this(CreateFilename(Guid.Empty)) { CreateReader(Guid.Empty); }
26          protected SerializationReader(string filename) { FileName = filename; CreateReader(); }          public SerializationReader(Guid guid) { CreateReader(guid); }
27            protected SerializationReader(string filename) { FileName = filename; }
28    
29                  
30    
31          #region ISerializationResultCount members          #region ISerializationResultCount members
32          public int ResultCount { get; protected set; }          public int ResultCount { get; protected set; }
# Line 21  namespace RomCheater.Serialization Line 34  namespace RomCheater.Serialization
34          private FileStream fileStream;          private FileStream fileStream;
35          protected BinaryReader binReader;          protected BinaryReader binReader;
36          protected string FileName { get; private set; }          protected string FileName { get; private set; }
37          private void CreateReader()          private void CreateReader(Guid guid)
38          {          {
39              fileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);              fileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
40              binReader = new BinaryReader(fileStream);              binReader = new BinaryReader(fileStream);

Legend:
Removed from v.402  
changed lines
  Added in v.444

  ViewVC Help
Powered by ViewVC 1.1.22