diff --git a/Nibriboard/RippleSpace/Chunk.cs b/Nibriboard/RippleSpace/Chunk.cs
index 1d5aa20..9cc745e 100644
--- a/Nibriboard/RippleSpace/Chunk.cs
+++ b/Nibriboard/RippleSpace/Chunk.cs
@@ -227,6 +227,11 @@ namespace Nibriboard.RippleSpace
return loadedChunk;
}
+ public async Task SaveTo(Stream destination)
+ {
+ throw new NotImplementedException("Error: Chunk saving hasn't been implemented yet!");
+ }
+
public void OnDeserialization(object sender)
{
UpdateAccessTime();
diff --git a/Nibriboard/RippleSpace/Plane.cs b/Nibriboard/RippleSpace/Plane.cs
index 891ec7f..46f9169 100644
--- a/Nibriboard/RippleSpace/Plane.cs
+++ b/Nibriboard/RippleSpace/Plane.cs
@@ -164,6 +164,34 @@ namespace Nibriboard.RippleSpace
return loadedChunk;
}
+ ///
+ /// Works out whether a chunk currently exists.
+ ///
+ /// The chunk location to check.
+ /// Whether the chunk at specified location exists or not.
+ public bool HasChunk(ChunkReference chunkLocation)
+ {
+ if(loadedChunkspace.ContainsKey(chunkLocation))
+ return true;
+
+ string chunkFilePath = Path.Combine(StorageDirectory, chunkLocation.AsFilename());
+ if(File.Exists(chunkFilePath))
+ return true;
+
+ return false;
+ }
+
+ public async Task SaveChunk(ChunkReference chunkLocation)
+ {
+ // It doesn't exist, so we can't save it :P
+ if(!loadedChunkspace.ContainsKey(chunkLocation))
+ return;
+
+ Chunk chunk = loadedChunkspace[chunkLocation];
+ string chunkFilePath = Path.Combine(StorageDirectory, chunkLocation.AsFilename());
+ await chunk.SaveTo(File.OpenWrite(chunkFilePath));
+ }
+
public async Task AddLine(DrawnLine newLine)
{
List chunkedLineParts;
@@ -216,6 +244,8 @@ namespace Nibriboard.RippleSpace
public void Save(Stream destination)
{
+
+
WriterOptions packingOptions = new WriterOptions(CompressionType.GZip);
IEnumerable chunkFiles = Directory.GetFiles(StorageDirectory);