- Timestamp:
- Jan 19, 2019, 6:12:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/FileCache/MapTileCache.cs
r346 r351 25 25 } 26 26 27 public void SetZoomCount (int count) {28 cache = new CurrentZoomFile[ count];27 public void SetZoomCount (int _count) { 28 cache = new CurrentZoomFile[_count]; 29 29 for (int i = 0; i < cache.Length; i++) { 30 30 cache [i] = new CurrentZoomFile (); … … 32 32 } 33 33 34 public byte[] LoadTile (int zoomlevel, stringfilename) {34 public byte[] LoadTile (int _zoomlevel, string _filename) { 35 35 try { 36 36 lock (cache) { 37 CurrentZoomFile cacheEntry = cache [ zoomlevel];37 CurrentZoomFile cacheEntry = cache [_zoomlevel]; 38 38 39 if (cacheEntry.filename == null || !cacheEntry.filename.Equals ( filename)) {40 cacheEntry.filename = filename;39 if (cacheEntry.filename == null || !cacheEntry.filename.Equals (_filename)) { 40 cacheEntry.filename = _filename; 41 41 42 if (!File.Exists ( filename)) {42 if (!File.Exists (_filename)) { 43 43 cacheEntry.pngData = null; 44 44 return null; … … 46 46 47 47 Profiler.BeginSample ("ReadPng"); 48 cacheEntry.pngData = ReadAllBytes ( filename);48 cacheEntry.pngData = ReadAllBytes (_filename); 49 49 Profiler.EndSample (); 50 50 } … … 59 59 } 60 60 61 public void SaveTile (int zoomlevel, byte[]contentPng) {61 public void SaveTile (int _zoomlevel, byte[] _contentPng) { 62 62 try { 63 63 lock (cache) { 64 CurrentZoomFile cacheEntry = cache [ zoomlevel];64 CurrentZoomFile cacheEntry = cache [_zoomlevel]; 65 65 66 66 string file = cacheEntry.filename; … … 69 69 } 70 70 71 cacheEntry.pngData = contentPng;71 cacheEntry.pngData = _contentPng; 72 72 73 73 Profiler.BeginSample ("WritePng"); 74 74 using (Stream stream = new FileStream (file, FileMode.Create, FileAccess.ReadWrite, FileShare.None, 75 75 4096)) { 76 stream.Write ( contentPng, 0,contentPng.Length);76 stream.Write (_contentPng, 0, _contentPng.Length); 77 77 } 78 78 Profiler.EndSample (); … … 83 83 } 84 84 85 public void ResetTile (int zoomlevel) {85 public void ResetTile (int _zoomlevel) { 86 86 try { 87 87 lock (cache) { 88 cache [ zoomlevel].filename = null;89 cache [ zoomlevel].pngData = null;88 cache [_zoomlevel].filename = null; 89 cache [_zoomlevel].pngData = null; 90 90 } 91 91 } catch (Exception e) { … … 94 94 } 95 95 96 public override byte[] GetFileContent (string filename) {96 public override byte[] GetFileContent (string _filename) { 97 97 try { 98 98 lock (cache) { 99 99 foreach (CurrentZoomFile czf in cache) { 100 if (czf.filename != null && czf.filename.Equals ( filename)) {100 if (czf.filename != null && czf.filename.Equals (_filename)) { 101 101 return czf.pngData; 102 102 } 103 103 } 104 104 105 if (!File.Exists ( filename)) {105 if (!File.Exists (_filename)) { 106 106 return transparentTile; 107 107 } 108 108 109 return ReadAllBytes ( filename);109 return ReadAllBytes (_filename); 110 110 } 111 111 } catch (Exception e) {
Note:
See TracChangeset
for help on using the changeset viewer.