OSDN Git Service
(root)
/
automap
/
automap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
500f367
)
nope this fixed it!
vgd
author
The Grand Dog
<alex.h@me.com>
Fri, 19 Jun 2020 15:16:24 +0000
(11:16 -0400)
committer
The Grand Dog
<alex.h@me.com>
Fri, 19 Jun 2020 15:16:24 +0000
(11:16 -0400)
Automap/Subsystems/Snapshot.cs
patch
|
blob
|
history
diff --git
a/Automap/Subsystems/Snapshot.cs
b/Automap/Subsystems/Snapshot.cs
index
22ce8cd
..
3c2eea0
100644
(file)
--- a/
Automap/Subsystems/Snapshot.cs
+++ b/
Automap/Subsystems/Snapshot.cs
@@
-8,6
+8,7
@@
using System.Threading.Tasks;
using Hjg.Pngcs;
using Hjg.Pngcs.Chunks;
using Hjg.Pngcs;
using Hjg.Pngcs.Chunks;
+using Vintagestory.API.Common;
namespace Automap
{
namespace Automap
{
@@
-26,7
+27,7
@@
namespace Automap
public Snapshotter(string path, ColumnsMetadata cols, int chunkSize, int worldSeed)
{
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;
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>
/// <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()
{
public async void Take()
{
- var t = new Stopwatch();
- t.Start();
-
- Console.WriteLine("snapshot started");
ImageInfo info = new ImageInfo(Width * chunkSize, Height * chunkSize, 8, false);
ImageInfo info = new ImageInfo(Width * chunkSize, Height * chunkSize, 8, false);
+
PngWriter snapWriter = FileHelper.CreatePngWriter(fileName, info, true);
PngWriter snapWriter = FileHelper.CreatePngWriter(fileName, info, true);
+
PngMetadata meta = snapWriter.GetMetadata( );
meta.SetTimeNow( );
var transparencyChunk = meta.CreateTRNSChunk( );
PngMetadata meta = snapWriter.GetMetadata( );
meta.SetTimeNow( );
var transparencyChunk = meta.CreateTRNSChunk( );
@@
-115,7
+110,6
@@
namespace Automap
{
Console.WriteLine("Snapshot exception!");
}
{
Console.WriteLine("Snapshot exception!");
}
- Console.WriteLine($"snapshot finished in {t.ElapsedMilliseconds}");
}
private async Task<Dictionary<int, byte[][]>> ReadAllInGroup(IGrouping<int, ColumnMeta> group)
}
private async Task<Dictionary<int, byte[][]>> ReadAllInGroup(IGrouping<int, ColumnMeta> group)