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

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

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

revision 429 by william, Tue May 28 15:16:05 2013 UTC revision 444 by william, Sun Jun 2 18:56:41 2013 UTC
# Line 16  namespace RomCheater.Serialization Line 16  namespace RomCheater.Serialization
16    
17          private int ResultsWritten = 0;          private int ResultsWritten = 0;
18    
19          public SearchResultWriter() : base() { }          //public SearchResultWriter() : base() { }
20          public SearchResultWriter(int resultCount) : base(resultCount) { WriteHeader(); }          public SearchResultWriter(int resultCount, Guid guid) : base(resultCount, guid) { WriteHeader(guid); }
21          public SearchResultWriter(string filename) : base(filename) { WriteHeader(); }          //public SearchResultWriter(string filename, Guid guid) : base(CreateFileName(filename,guid), guid) { WriteHeader(guid); }
22          public SearchResultWriter(string filename, int resultCount) : base(filename, resultCount, false) { WriteHeader(); }          //public SearchResultWriter(string filename, int resultCount, Guid guid) : base(filename, resultCount, guid, false) { WriteHeader(guid); }
23          public SearchResultWriter(string filename, int resultCount, bool delete) : base(filename, resultCount, delete) { WriteHeader(); }          //public SearchResultWriter(string filename, int resultCount, Guid guid, bool delete) : base(filename, resultCount, guid, delete) { WriteHeader(guid); }      
24          #region ISearchResultWriter members          #region ISearchResultWriter members
25          public void WriteResult<TValue>(uint address, TValue value) where TValue : IConvertible          public void WriteResult<TValue>(uint address, TValue value) where TValue : IConvertible
26          {          {
# Line 59  namespace RomCheater.Serialization Line 59  namespace RomCheater.Serialization
59          }          }
60          #endregion          #endregion
61    
62          private void WriteHeader()          private void WriteHeader(Guid guid)
63          {          {
64              // write magic: SRD              // write magic: SRD
65              binWriter.Write(Encoding.UTF8.GetBytes("SRD"));              binWriter.Write(Encoding.UTF8.GetBytes("SRD"));
66              // write version (int)  
67              binWriter.Write((int)1);              if (guid == Guid.Empty)
68                {
69                    binWriter.Write((int)1);
70                }
71                else
72                {
73                    binWriter.Write((int)2);
74                    // related guid - length
75                    binWriter.Write(guid.ToByteArray().Length);
76                    // related guid - data
77                    binWriter.Write(guid.ToByteArray());
78                }            
79              // write count (int)              // write count (int)
80              binWriter.Write(ResultCount);              binWriter.Write(ResultCount);
81          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.22