private static void featuresDownloadCompleteCallback(object otile, DownloadInfo info, string featuresFileName, byte[] dataDownloaded) { #if DEBUG LibSys.StatusBar.Trace("IP: TileCache:featuresDownloadCompleteCallback() - " + info.baseName + " " + (dataDownloaded == null? "null" : "" + dataDownloaded.Length) + " bytes loaded"); #endif Features features = (Features)m_featuresCache[info.baseName]; Tile tile = (Tile)otile; if (dataDownloaded == null || info.is404 || Project.is404(dataDownloaded)) { string comment = dataDownloaded == null ? "no data" : "404"; if (features != null) { features.IsEmpty = true; // proven empty } ProgressMonitor.markComplete(info.monitored, false, comment); } else { FileStream fs = null; try { string comment = "" + dataDownloaded.Length + " bytes"; fs = new FileStream(featuresFileName, FileMode.Create); fs.Write(dataDownloaded, 0, dataDownloaded.Length); fs.Close(); fs = null; #if DEBUG LibSys.StatusBar.Trace("OK: file " + featuresFileName + " created"); #endif if (features != null) { features.Fill(); } ProgressMonitor.markComplete(info.monitored, true, comment); } catch (Exception e) { #if DEBUG LibSys.StatusBar.Error("" + e); #endif if (features != null) { features.IsEmpty = true; // proven empty } ProgressMonitor.markComplete(info.monitored, false, e.Message); } finally { if (fs != null) { fs.Close(); } } } if (tile != null) { tile.featuresArrived(features); } }