Index: binary-improvements/7dtd-server-fixes/src/FileCache/MapTileCache.cs
===================================================================
--- binary-improvements/7dtd-server-fixes/src/FileCache/MapTileCache.cs	(revision 329)
+++ binary-improvements/7dtd-server-fixes/src/FileCache/MapTileCache.cs	(revision 331)
@@ -46,5 +46,5 @@
 
 						Profiler.BeginSample ("ReadPng");
-						cacheEntry.pngData = File.ReadAllBytes (filename);
+						cacheEntry.pngData = ReadAllBytes (filename);
 						Profiler.EndSample ();
 					}
@@ -63,6 +63,7 @@
 				lock (cache) {
 					CurrentZoomFile cacheEntry = cache [zoomlevel];
-					
-					if (string.IsNullOrEmpty (cacheEntry.filename)) {
+
+					string file = cacheEntry.filename;
+					if (string.IsNullOrEmpty (file)) {
 						return;
 					}
@@ -71,5 +72,8 @@
 
 					Profiler.BeginSample ("WritePng");
-					File.WriteAllBytes (cacheEntry.filename, contentPng);
+					using (Stream stream = new FileStream (file, FileMode.Create, FileAccess.ReadWrite, FileShare.None,
+						4096)) {
+						stream.Write (contentPng, 0, contentPng.Length);
+					}
 					Profiler.EndSample ();
 				}
@@ -92,5 +96,5 @@
 					}
 
-					return File.ReadAllBytes (filename);
+					return ReadAllBytes (filename);
 				}
 			} catch (Exception e) {
@@ -101,4 +105,24 @@
 		}
 
+		private static byte[] ReadAllBytes (string _path) {
+			using (FileStream fileStream = new FileStream(_path, FileMode.Open, FileAccess.Read, FileShare.Read, 4096)) {
+				int bytesRead = 0;
+				int bytesLeft = (int) fileStream.Length;
+				byte[] result = new byte[bytesLeft];
+				while (bytesLeft > 0) {
+					int readThisTime = fileStream.Read (result, bytesRead, bytesLeft);
+					if (readThisTime == 0) {
+						throw new IOException ("Unexpected end of stream");
+					}
+
+					bytesRead += readThisTime;
+					bytesLeft -= readThisTime;
+				}
+
+				return result;
+			}
+		}
+
+
 		private class CurrentZoomFile {
 			public string filename;
