using System; using System.Data; using System.Configuration; using System.Web; using DS.ImageCache; // TODO: Change the line below to match the namespace of the imported XMLWrapper proxy stub. // This version is using the generated proxy stub in Reference.cs using DS.WebServices.Calm.XMLWrapper; namespace DS.Examples.XMLWrapper { public class BrokerImageCache : DS.ImageCache.ImageCache { private string database; private ContentService webService; private static ImageCacheSettingsManager settingsManager = new ImageCacheSettingsManager(); public BrokerImageCache(string configurationFolder, string path, ImageCacheSettings settings, string subCategory, string database, ContentService webService) : base(configurationFolder, path, settings, subCategory) { this.database = database; this.webService = webService; } public static ImageCacheSettingsManager SettingsManager { get { return settingsManager; } } public override ImageCacheItem GetImage(string id, object oldCookie, bool newImage, int page) { UInt32 oldCrc = 0; if (oldCookie != null) { oldCrc = (UInt32)oldCookie; } CachedImage img = webService.GetCachedImage(database, id, oldCrc, newImage); if (img.Error != null && img.Error.Length > 0 ) { // Function has returned an error. Throw an exception. throw new Exception(img.Error); } if (newImage || img.Crc == 0 || img.Crc != oldCrc) { // New item has been loaded. Return it. ImageCacheItem item = new ImageCacheItem(id, img.Crc, img.Data, img.MimeType); return item; } return null; } public override string ToString() { return database + " - " + base.ToString(); } } }