/// <summary> /// Initializes a new instance of the <see cref="FeedSource"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="location">The feedlist URL</param> internal BanditFeedSource(INewsComponentsConfiguration configuration, SubscriptionLocation location) { p_configuration = configuration; if (p_configuration == null) { p_configuration = DefaultConfiguration; } this.location = location; // check for programmers error in configuration: ValidateAndThrow(Configuration); LoadFeedlistSchema(); rssParser = new RssParser(this); if (!String.IsNullOrEmpty(EnclosureFolder)) { enclosureDownloader = new BackgroundDownloadManager(this); enclosureDownloader.DownloadCompleted += OnEnclosureDownloadComplete; } AsyncWebRequest = new AsyncWebRequest(); AsyncWebRequest.OnAllRequestsComplete += OnAllRequestsComplete; }
/// <summary> /// Gets the required per storage domain data service. /// </summary> /// <param name="domain">The domain.</param> /// <param name="configuration">The configuration.</param> /// <returns></returns> public static object GetService(StorageDomain domain, INewsComponentsConfiguration configuration) { configuration.ExceptionIfNull("configuration"); IInitDataService service = new FileStorageDataService(); if (domain == StorageDomain.UserCacheData) { service.Initialize(Path.Combine( configuration.UserLocalApplicationDataPath, "Cache")); } else if (domain == StorageDomain.UserData) { service.Initialize( configuration.UserApplicationDataPath); } else if (domain == StorageDomain.UserRoamingData) { service.Initialize( configuration.UserLocalApplicationDataPath); } else { Debug.Assert(false, "No data service for StorageDomain: " + domain); } return(service); }
/// <summary> /// Initializes a new instance of the <see cref="FeedSource"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="location">The user credentials</param> internal FacebookFeedSource(INewsComponentsConfiguration configuration, SubscriptionLocation location) { this.p_configuration = configuration; if (this.p_configuration == null) { this.p_configuration = FeedSource.DefaultConfiguration; } this.location = location; // check for programmers error in configuration: ValidateAndThrow(this.Configuration); //If only Domain is set then we have the auth token otherwise we have secret + session key + uid if (String.IsNullOrEmpty(location.Credentials.UserName) && String.IsNullOrEmpty(location.Credentials.Password) && !String.IsNullOrEmpty(location.Credentials.Domain)) { SetAuthToken(location.Credentials.Domain); GetSessionKey(); } else { this.facebookUserId = location.Credentials.UserName; this.clientSecret = location.Credentials.Password; this.sessionKey = location.Credentials.Domain; } this.AsyncWebRequest = new AsyncWebRequest(); this.AsyncWebRequest.OnAllRequestsComplete += this.OnAllRequestsComplete; }
/// <summary> /// Default constructor /// </summary> /// <param name="configuration">The configuration.</param> /// <exception cref="ArgumentNullException">if newsHandler or configuration are null</exception> /// <exception cref="IOException">On indexPath directory creation failures</exception> /// <exception cref="SecurityException">On indexPath directory creation failures</exception> public LuceneSearch(INewsComponentsConfiguration configuration) { if (configuration.SearchIndexBehavior != SearchIndexBehavior.NoIndexing) { this._settings = new LuceneSettings(configuration); startIndexAll = (this._settings.IsRAMBasedSearch || IsIndexCorrupted(this._settings.GetIndexDirectory()) || !IndexReader.IndexExists(this._settings.GetIndexDirectory())); this._indexModifier = new LuceneIndexModifier(this._settings); } }
internal FeedlyCloudFeedSource(INewsComponentsConfiguration configuration, SubscriptionLocation location) { this.p_configuration = configuration; if (this.p_configuration == null) { this.p_configuration = FeedSource.DefaultConfiguration; } this.location = location; // check for programmers error in configuration: ValidateAndThrow(this.Configuration); //register with background thread for updating Google Reader FeedlyCloudUpdater.RegisterFeedSource(this); }
private static string BuildAndCreateIndexDirectoryPath(INewsComponentsConfiguration configuration) { string path = null; if (configuration.SearchIndexBehavior != SearchIndexBehavior.NoIndexing) { switch (configuration.SearchIndexBehavior) { case SearchIndexBehavior.LocalAppDataDirectoryBased: { path = Path.Combine(configuration.UserLocalApplicationDataPath, IndexFolderName); break; } case SearchIndexBehavior.AppDataDirectoryBased: { path = Path.Combine(configuration.UserApplicationDataPath, IndexFolderName); break; } case SearchIndexBehavior.TempDirectoryBased: { path = Path.Combine(Path.GetTempPath(), String.Format("{0}.{1}", configuration.ApplicationID, IndexFolderName)); break; } } if (path != null) { if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } } } return(path); }
/// <summary> /// Initializes a new instance of the <see cref="LuceneSettings"/> class. /// </summary> /// <param name="configuration">The configuration.</param> public LuceneSettings(INewsComponentsConfiguration configuration) { settings = configuration.PersistedSettings; behavior = configuration.SearchIndexBehavior; indexPath = BuildAndCreateIndexDirectoryPath(configuration); }