ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Serialization/SerializationReader.cs
(Generate patch)

Comparing trunk/RomCheater/Serialization/SerializationReader.cs (file contents):
Revision 402 by william, Thu Jun 21 06:30:33 2012 UTC vs.
Revision 444 by william, Sun Jun 2 18:56:41 2013 UTC

# Line 8 | Line 8 | namespace RomCheater.Serialization
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) { CreateReader(guid); }
27 >        protected SerializationReader(string filename) { FileName = filename; }
28  
29 +              
30  
31          #region ISerializationResultCount members
32          public int ResultCount { get; protected set; }
# Line 21 | Line 34 | namespace RomCheater.Serialization
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines