OSDN Git Service

nope this fixed it! vgd
authorThe Grand Dog <alex.h@me.com>
Fri, 19 Jun 2020 15:16:24 +0000 (11:16 -0400)
committerThe Grand Dog <alex.h@me.com>
Fri, 19 Jun 2020 15:16:24 +0000 (11:16 -0400)
Automap/Subsystems/Snapshot.cs

index 22ce8cd..3c2eea0 100644 (file)
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
 
 using Hjg.Pngcs;
 using Hjg.Pngcs.Chunks;
+using Vintagestory.API.Common;
 
 namespace Automap
 {
@@ -26,7 +27,7 @@ namespace Automap
 
                public Snapshotter(string path, ColumnsMetadata cols, int chunkSize, int worldSeed)
                {
-                       this.fileName = Path.Combine(path, $"snapshot_{worldSeed}_{DateTime.UtcNow:u}.png");
+                       this.fileName = Path.Combine(path, $"snapshot_{worldSeed}.png");
                        this.chunkPath = Path.Combine(path, AutomapSystem._chunkPath);
                        this.cols = cols;
                        this.chunkSize = chunkSize;
@@ -35,19 +36,13 @@ namespace Automap
                /// <summary>
                /// takes a snapshot. this should be called from an extra thread.
                /// </summary>
-               /// <param name="path">path to the map dir</param>
-               /// <param name="chunkPath">name of the chunks dir part thing</param>
-               /// <param name="cols"></param>
-               /// <param name="chunkSize"></param>
                public async void Take()
                {
-                       var t = new Stopwatch();
-                       t.Start();
-
-                       Console.WriteLine("snapshot started");
 
                        ImageInfo info = new ImageInfo(Width * chunkSize, Height * chunkSize, 8, false);
+
                        PngWriter snapWriter = FileHelper.CreatePngWriter(fileName, info, true);
+
                        PngMetadata meta = snapWriter.GetMetadata( );
                        meta.SetTimeNow( );
                        var transparencyChunk = meta.CreateTRNSChunk( );
@@ -115,7 +110,6 @@ namespace Automap
                        {
                                Console.WriteLine("Snapshot exception!");
                        }
-                       Console.WriteLine($"snapshot finished in {t.ElapsedMilliseconds}");
                }
 
                private async Task<Dictionary<int, byte[][]>> ReadAllInGroup(IGrouping<int, ColumnMeta> group)