/[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

--- trunk/RomCheater/Serialization/SearchResultWriter.cs	2013/05/28 20:44:13	443
+++ trunk/RomCheater/Serialization/SearchResultWriter.cs	2013/06/02 18:56:41	444
@@ -16,11 +16,11 @@
 
         private int ResultsWritten = 0;
 
-        public SearchResultWriter() : base() { }
-        public SearchResultWriter(int resultCount) : base(resultCount) { WriteHeader(); }
-        public SearchResultWriter(string filename) : base(filename) { WriteHeader(); }
-        public SearchResultWriter(string filename, int resultCount) : base(filename, resultCount, false) { WriteHeader(); }
-        public SearchResultWriter(string filename, int resultCount, bool delete) : base(filename, resultCount, delete) { WriteHeader(); }
+        //public SearchResultWriter() : base() { }
+        public SearchResultWriter(int resultCount, Guid guid) : base(resultCount, guid) { WriteHeader(guid); }
+        //public SearchResultWriter(string filename, Guid guid) : base(CreateFileName(filename,guid), guid) { WriteHeader(guid); }
+        //public SearchResultWriter(string filename, int resultCount, Guid guid) : base(filename, resultCount, guid, false) { WriteHeader(guid); }
+        //public SearchResultWriter(string filename, int resultCount, Guid guid, bool delete) : base(filename, resultCount, guid, delete) { WriteHeader(guid); }      
         #region ISearchResultWriter members
         public void WriteResult<TValue>(uint address, TValue value) where TValue : IConvertible
         {
@@ -59,12 +59,23 @@
         }
         #endregion
 
-        private void WriteHeader()
+        private void WriteHeader(Guid guid)
         {
             // write magic: SRD
             binWriter.Write(Encoding.UTF8.GetBytes("SRD"));
-            // write version (int)
-            binWriter.Write((int)1);
+
+            if (guid == Guid.Empty)
+            {
+                binWriter.Write((int)1);
+            }
+            else
+            {
+                binWriter.Write((int)2);
+                // related guid - length
+                binWriter.Write(guid.ToByteArray().Length);
+                // related guid - data
+                binWriter.Write(guid.ToByteArray());
+            }            
             // write count (int)
             binWriter.Write(ResultCount);
         }

 

  ViewVC Help
Powered by ViewVC 1.1.22