From e65d8ea78e343de8704b48ca98eb0b82346a9ca3 Mon Sep 17 00:00:00 2001 From: melchior Date: Thu, 19 Mar 2020 21:27:14 -0400 Subject: [PATCH] Pre-RC1: Added Tab delimited POI/EOI report file --- Automap/Subsystems/AutomapSystem.cs | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Automap/Subsystems/AutomapSystem.cs b/Automap/Subsystems/AutomapSystem.cs index 7af9a94..8295017 100644 --- a/Automap/Subsystems/AutomapSystem.cs +++ b/Automap/Subsystems/AutomapSystem.cs @@ -36,6 +36,7 @@ namespace Automap private const string chunkFile_filter = @"*_*.png"; private const string poiFileName = @"poi_binary"; private const string eoiFileName = @"eoi_binary"; + private const string pointsTsvFileName = @"points_of_interest.tsv"; private static Regex chunkShardRegex = new Regex(@"(?[\d]+)_(?[\d]+).png", RegexOptions.Singleline); private ConcurrentDictionary columnCounter = new ConcurrentDictionary(3, 150); @@ -225,7 +226,6 @@ namespace Automap //What about chunk updates themselves; a update bitmap isn't kept... updatedChunksTotal += updatedChunks; GenerateJSONMetadata(); - PersistPointsData( ); updatedChunks = 0; } @@ -251,6 +251,7 @@ namespace Automap finally { Logger.VerboseDebug("Thread '{0}' executing finally block.", Thread.CurrentThread.Name); + PersistPointsData( ); } } @@ -532,7 +533,7 @@ namespace Automap /// private void PersistPointsData( ) { - //POI and EOI raw dump files ~ reload em! + //POI and EOI raw dump files ~ WRITE em! //var poiRawFile = File. string poiPath = Path.Combine(path, poiFileName); string eoiPath = Path.Combine(path, eoiFileName); @@ -548,6 +549,31 @@ namespace Automap Serializer.Serialize(eoiFile, this.EOIs); } } + + //Create Easy to Parse CSV file for tool/human use.... + string pointsTsvPath = Path.Combine(path, pointsTsvFileName); + + using (var tsvWriter = new StreamWriter(pointsTsvPath, false, Encoding.UTF8)) + { + tsvWriter.WriteLine("Name\tDescription\tLocation\tTime\t"); + foreach (var point in this.POIs) { + tsvWriter.Write(point.Name + "\t"); + tsvWriter.Write(point.Notes + "\t"); + tsvWriter.Write(point.Location.PrettyCoords(ClientAPI) + "\t"); + tsvWriter.Write(point.Timestamp.ToString("u")+"\t"); + tsvWriter.WriteLine(); + } + foreach (var entity in this.EOIs) { + tsvWriter.Write(entity.Name + "\t"); + tsvWriter.Write(entity.Notes + "\t"); + tsvWriter.Write(entity.Location.PrettyCoords(ClientAPI) + "\t"); + tsvWriter.Write(entity.Timestamp.ToString("u") + "\t"); + tsvWriter.WriteLine( ); + } + tsvWriter.WriteLine(); + tsvWriter.Flush( ); + } + } private ColumnMeta CreateColumnMetadata(KeyValuePair mostActiveCol, IMapChunk mapChunk) -- 2.11.0