52
52
// Set the default values for the properties
53
53
this.UseSSL = false;
54
54
this.APIBaseAddress = "http://api.twitter.com/1/";
56
#if !LITE && !SILVERLIGHT
57
this.CacheOutput = false;
58
this.CacheTimespan = new TimeSpan(0, 5, 0);
59
this.ReadConfigurationSettings();
63
57
/// <include file='OptionalProperties.xml' path='OptionalProperties/Property[@name="UseSSL"]/*'/>
73
67
/// <include file='OptionalProperties.xml' path='OptionalProperties/Property[@name="Proxy"]/*'/>
74
68
public WebProxy Proxy { get; set; }
77
#if !LITE && !SILVERLIGHT
78
/// <include file='OptionalProperties.xml' path='OptionalProperties/Property[@name="CacheOutput"]/*'/>
79
public bool CacheOutput { get; set; }
81
/// <include file='OptionalProperties.xml' path='OptionalProperties/Property[@name="CacheTimespan"]/*'/>
82
public TimeSpan CacheTimespan { get; set; }
85
/// Reads the configuration settings.
87
private void ReadConfigurationSettings()
90
System.Collections.Specialized.NameValueCollection appSettings = ConfigurationManager.AppSettings;
92
// Get the enable caching configuration setting
93
if (!string.IsNullOrEmpty(appSettings["Twitterizer2.EnableCaching"]) &&
94
appSettings["Twitterizer2.EnableCaching"].ToLower().Trim() == "true")
96
this.CacheOutput = true;
99
// Get the cache timeout setting
100
string cacheTimeoutSetting = appSettings["Twitterizer2.CacheTimeout"];
101
long cacheTimeoutSeconds;
102
if (!string.IsNullOrEmpty(appSettings["Twitterizer2.CacheTimeout"]) &&
103
long.TryParse(cacheTimeoutSetting, out cacheTimeoutSeconds))
105
// Convert the seconds value to ticks and instantiate a new timespan
106
this.CacheTimespan = new TimeSpan(cacheTimeoutSeconds * 10000000);
109
// Get the SSL setting
110
if (!string.IsNullOrEmpty(appSettings["Twitterizer2.EnableSSL"]) &&
111
appSettings["Twitterizer2.EnableSSL"].ToLower().Trim() == "true")