OSDN Git Service

W.I.P. Point scan / dumper for ShardProcessor
authormelchior <melchior@users.osdn.me>
Tue, 26 Jan 2021 23:39:26 +0000 (18:39 -0500)
committermelchior <melchior@users.osdn.me>
Tue, 26 Jan 2021 23:39:26 +0000 (18:39 -0500)
ShardProcessor/Program.cs

index 1e69ba6..bcdf124 100644 (file)
@@ -50,10 +50,14 @@ namespace ShardProcessor
                                Process_ShardData( );
                        break;
 
-                       case @"--scan":
+                       case @"--shards":
                                Scan_ShardData( );
                        break;
 
+                       case @"--points":
+                               Scan_PointsData( );                     
+                       break;
+
                default:
                        Console.WriteLine("Unrecognized Command: {0}", command);
                        break;
@@ -111,6 +115,56 @@ namespace ShardProcessor
                
                }
 
+
+               private static void Scan_PointsData( )
+               {
+               try {
+               var eoiFile = new FileInfo(Path.Combine(mapPath, @"eoi_binary"));
+               var poiFile = new FileInfo(Path.Combine(mapPath, @"poi_binary"));
+               uint entities = 0, points = 0;
+
+               if (eoiFile.Exists) {
+               using (var eoiStream = eoiFile.OpenRead( )) {
+                                               
+               EntitiesOfInterest eoiData = Serializer.Deserialize<EntitiesOfInterest>(eoiStream);
+
+               foreach (var entry in eoiData) {
+                       Console.WriteLine("#{0}, [{1}], '{2}', {3}",
+                       entry.EntityId,
+                       entry.Location,
+                         entry.Name,
+                       entry.Timestamp.ToUniversalTime( )
+                                               );
+                       entities++;
+               }
+               Console.WriteLine("Entities Of Interest: {0}", entities);
+               }
+               
+
+               if (poiFile.Exists) {
+               using (var poiStream = poiFile.OpenRead( )) {
+               
+               PointsOfInterest poiData = Serializer.Deserialize<PointsOfInterest>(poiStream);
+               foreach (var entry in poiData) {
+                       Console.WriteLine("[{0}], {1}, {2}, {3}",
+                       entry.Location,
+                       entry.Name,
+                       entry.Destination,
+                       entry.Timestamp.ToUniversalTime( )
+                       );
+                       points++;                               
+               }
+               }
+               Console.WriteLine("Points Of Interest: {0}", points);
+               }
+
+               }
+               } catch (Exception uhOh) {
+               Console.WriteLine(uhOh);
+               }
+
+               }
+
                private static void Scan_ShardData( )
                {
                var shardsDir = new DirectoryInfo(Path.Combine(mapPath, _chunkPath));