private System.Collections.Generic.List <string> GetPlugins(string BasePath) { System.Collections.Generic.List <string> AllPlugins = new System.Collections.Generic.List <string>(); string PluginListName = System.IO.Path.Combine(BasePath, "plugins.txt"); if (System.IO.File.Exists(PluginListName)) { try { foreach (string FullEntry in System.IO.File.ReadAllLines(PluginListName)) { string Entry = FullEntry.Trim(); if (Entry.Length > 0) { AllPlugins.Add(Entry); } } } catch (System.Exception ex) { System.Console.WriteLine("Failed to read plugin list file: {0}", ex.Message); } } return(AllPlugins); }
/// <summary> /// This method returns a full entry for a given id while using as much from the cache as possible /// </summary> /// <param name="id">The id</param> /// <param name="doNotUseCache">if you want to load everything from Proxer, ignoring the cache. WARNING: Do not use this regularly</param> /// <returns>A full entry from Proxer</returns> public async Task <FullEntry> GetFullEntry(int id, bool doNotUseCache = false) { var fullEntryEndPoint = "https://Proxer.me/api/v1/info/fullentry"; var entryEndPoint = "https://Proxer.me/api/v1/info/entry"; FullEntry result; var postParameters = new Dictionary <string, string>(); if (id > 0) { postParameters.Add("id", id.ToString()); } if (doNotUseCache) // insert Spongebob Meme { result = await GetData <FullEntry>(postParameters, fullEntryEndPoint); } else { // Database stuff for enablin the cache if (DatabaseConnection != null) { // DatabaseCaching is enabled so we use it! var dbResult = DatabaseConnection.Get(id, typeof(EntryDetail)).Cast <EntryDetail>(); if (dbResult.Any()) { result = new FullEntry(); result.data = dbResult.First(); result.code = 1; } else { result = await GetData <FullEntry>(postParameters, entryEndPoint); DatabaseConnection.Put(result.data); } } else { // Database caching is not available, so use memory caching result = await GetData <FullEntry>(postParameters, entryEndPoint); if (CachingController.CanPopulateEntryFromCache(result.data, result.data.id)) { CachingController.PopulateEntryFromCache(result.data, result.data.id); } else { result = await GetData <FullEntry>(postParameters, fullEntryEndPoint); CachingController.CacheAllCacheableProperties(result.data, result.data.id); } } } return(result); }