/[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 450 by william, Sun Jun 2 20:38:58 2013 UTC revision 451 by william, Sun Jun 2 21:37:09 2013 UTC
# Line 39  namespace RomCheater.Serialization Line 39  namespace RomCheater.Serialization
39   protected const string DEFAULT_FILENAME = "SerializedMemoryResults.tmp";   protected const string DEFAULT_FILENAME = "SerializedMemoryResults.tmp";
40          //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);
41          //public SerializationReader() : this(CreateFilename(Guid.Empty)) { CreateReader(Guid.Empty); }          //public SerializationReader() : this(CreateFilename(Guid.Empty)) { CreateReader(Guid.Empty); }
42          public SerializationReader(Guid guid) { CreateFilename(guid); CreateReader(guid); }          public SerializationReader(Guid guid) { CreateFilename(guid); }
43          //protected SerializationReader(string filename) { FileName = filename; }          //protected SerializationReader(string filename) { FileName = filename; }
44    
45          protected virtual string TemporaryFolder { get { return string.Empty; } }          protected virtual string TemporaryFolder { get { return string.Empty; } }
# Line 51  namespace RomCheater.Serialization Line 51  namespace RomCheater.Serialization
51          #region ISerializationResultCount members          #region ISerializationResultCount members
52          public int ResultCount { get; protected set; }          public int ResultCount { get; protected set; }
53          #endregion          #endregion
54          private FileStream fileStream;          //private FileStream fileStream;
55          protected BinaryReader binReader;          //protected BinaryReader binReader;
56          protected string FileName { get; private set; }          protected string FileName { get; private set; }
57          private void CreateReader(Guid guid)          protected FileStream CreateReader(Guid guid)
58          {          {
59              if (Cancelled) { return; }              return new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
             fileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);  
             binReader = new BinaryReader(fileStream);  
60          }          }
61              #region IDisposable Support              #region IDisposable Support
62          // Track whether Dispose has been called.          // Track whether Dispose has been called.
# Line 101  namespace RomCheater.Serialization Line 99  namespace RomCheater.Serialization
99                  // If disposing is false,                  // If disposing is false,
100                  // only the following code is executed.                  // only the following code is executed.
101                                
102                  // clean up any resources                  //// clean up any resources
103                  binReader.Close();                  //binReader.Close();
104                  binReader = null;                  //binReader = null;
105                  fileStream = null;                                  //fileStream = null;                
106                  // Note disposing has been done.                  // Note disposing has been done.
107                  disposed = true;                  disposed = true;
108    

Legend:
Removed from v.450  
changed lines
  Added in v.451

  ViewVC Help
Powered by ViewVC 1.1.22