/// <summary> /// Create a new client /// </summary> /// <param name="r">Region</param> /// <param name="loc">Current Culture</param> /// <param name="publicKey">public key for authentication</param> /// <param name="privateKey">private key for authentication</param> /// <param name="cache">Use a </param> public BaseClient(Region r, System.Globalization.CultureInfo loc, string publicKey = null, string privateKey = null, bool cache = true) { // default to current culture Locale = loc; this.Region = r; // need a workaround for this in silverlight #if !SILVERLIGHT //Change SSL checks so that all checks pass ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback( delegate { return(true); } ); #endif try { Cache.DiskBackend backend = new Cache.DiskBackend("data.cache", 10 * 1024 * 1024, null); this.cache = new Cache.Cache(backend); } catch (Exception ex) { // no cache Console.WriteLine(ex.Message); } }
public void Dispose() { if (cache != null) { cache.Dispose(); } cache = null; }