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

Comparing trunk/RomCheater/Serialization/SerializationWriter.cs (file contents):
Revision 401 by william, Thu Jun 21 05:14:38 2012 UTC vs.
Revision 405 by william, Thu Jun 21 14:38:54 2012 UTC

# Line 6 | Line 6 | using System.IO;
6  
7   namespace RomCheater.Serialization
8   {
9 <    public interface ISerializationWriter
9 >    public interface ISerializationResultCount
10      {
11 <        int ResultCount { get; }
11 >        int ResultCount { get; }    
12      }
13 <    public abstract class SerializationWriter : ISerializationWriter, IDisposable
13 >  
14 >    public abstract class SerializationWriter : ISerializationResultCount, IDisposable
15      {
16          private const string DEFAULT_FOLDER = "tmp";
17          private const string DEFAULT_FILENAME = "SerializedMemoryResults.tmp";
18          private static string DEFAULT_PATH = string.Format(@"{0}\{1}", DEFAULT_FOLDER,DEFAULT_FILENAME);
19          public SerializationWriter() : this(DEFAULT_PATH) { }
20 <        protected SerializationWriter(string filename) : this(filename, 0) { }
21 <        public SerializationWriter(int resultCount) : this(DEFAULT_PATH, resultCount) { }
22 <        public SerializationWriter(string filename, int resultCount) { FileName = filename; ResultCount = resultCount; CreateFile(); }
20 >        protected SerializationWriter(string filename) : this(filename, 0, true) { }
21 >        public SerializationWriter(int resultCount) : this(DEFAULT_PATH, resultCount, true) { }
22 >        public SerializationWriter(string filename, int resultCount, bool delete) { FileName = filename; ResultCount = resultCount; CreateFile(delete); }
23  
24 <        #region ISerializationWriter members
24 >        #region ISerializationResultCount members
25          public int ResultCount { get; protected set; }
25        
26          #endregion
27          private FileStream fileStream;
28          protected BinaryWriter binWriter;
# Line 44 | Line 44 | namespace RomCheater.Serialization
44                  return false;
45              }
46          }
47 <        private void CreateFile()
47 >        private void CreateFile(bool delete)
48          {
49 <            DeleteResultFile();
49 >            if (delete)
50 >                DeleteResultFile();
51              FileInfo fi = new FileInfo(FileName);
52              if (!fi.Exists)
53              {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines