private IFeedStorage LoadProvider(Type type, XmlNode configData) { //object[] objArray; ConstructorInfo info = null; //ISoapTransport transport = null; if (Utility.ImplementsInterface(type, typeof(IFeedStorage))) { if (configData != null) { info = type.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null); if (info == null) { throw new ArgumentException("No constructor"); } IFeedStorage storage = info.Invoke(null) as IFeedStorage; if (storage != null) { // Call the Init storage.Init(configData); } return(storage); } } return(null); }
// Dependencies can be injected via the constructor public RssCommands(DiscordSocketClient client, ISpeaker speaker, IFeedStorage feedStorage, RssController controller) { _client = client; _speaker = speaker; _feedStorage = feedStorage; _controller = controller; }
public Bot(IFeedStorage storage, ISpeaker speaker) { Speaker = speaker; Speaker.FinishedPlaying += StopPlaying; Storage = storage; }
private void InitCommentsView(IFeedStorage storage, FeedNS.Feed feed) { IList <CommentInfo> comments = BuildCommentsList(storage.GetFeedComments(feed.Id)); //AppendChildsComments(ref comments, storage.GetFeedComments(feed.Id)); ConfigureComments(commentList, feed); commentList.Items = comments; commentList.TotalCount = GetCommentsCount(comments); }
public static bool VoteForPoll(List<long> userAnswersIDs, IFeedStorage storage, long pollId, out string errorMessage) { errorMessage = string.Empty; storage.PollVote(SecurityContext.CurrentAccount.ID.ToString(), userAnswersIDs); var pollFeed = storage.GetFeed(pollId); if (pollFeed == null) { errorMessage = Resources.NewsResource.ErrorAccessDenied; return false; } return true; }
public static bool VoteForPoll(List <long> userAnswersIDs, IFeedStorage storage, long pollId, out string errorMessage) { errorMessage = string.Empty; storage.PollVote(SecurityContext.CurrentAccount.ID.ToString(), userAnswersIDs); var pollFeed = storage.GetFeed(pollId); if (pollFeed == null) { errorMessage = Resources.NewsResource.ErrorAccessDenied; return(false); } return(true); }
private void InitCommentsView(IFeedStorage storage, Feed feed) { IList <CommentInfo> comments = new List <CommentInfo>(); comments = BuildCommentsList(feed, storage.GetFeedComments(feed.Id)); //AppendChildsComments(ref comments, storage.GetFeedComments(feed.Id)); ConfigureComments(commentList, feed); commentList.Items = comments; commentList.CommentsCountTitle = GetCommentsCount(comments).ToString(CultureInfo.CurrentCulture); commentList.TotalCount = GetCommentsCount(comments); }
public DbFeedStorageTest() { var dbType = DbType.SQLite; if (dbType == DbType.MySQL) { DbRegistry.RegisterDatabase("news", "MySql.Data.MySqlClient", "Server=teamlab;Database=Test;UserID=dev;Pwd=dev"); //new DbManager("news").ExecuteNonQuery(NewsResource.DbSchema_MySQL); } if (dbType == DbType.SQLite) { DbRegistry.RegisterDatabase("news", "System.Data.SQLite", "Data Source=feed.sqlite;Version=3"); //new DbManager("news").ExecuteNonQuery(NewsResource.DbSchema_SQLite); } feedStorage = new DbFeedStorage(10); }
public DbFeedStorageTest() { var dbType = DbType.SQLite; if (dbType == DbType.MySQL) { DbRegistry.RegisterDatabase("news", "MySql.Data.MySqlClient", "Server=teamlab;Database=Test;UserID=dev;Pwd=dev"); //new DbManager("news").ExecuteNonQuery(NewsResource.DbSchema_MySQL); } if (dbType == DbType.SQLite) { DbRegistry.RegisterDatabase("news", "System.Data.SQLite", "Data Source=feed.sqlite;Version=3"); //new DbManager("news").ExecuteNonQuery(NewsResource.DbSchema_SQLite); } feedStorage = new DbFeedStorage(10); }
private void LoadProviders(XmlElement element) { IFeedStorage storage; string name = element.GetAttribute("name"); string typeName = element.GetAttribute("type"); bool enabled = Boolean.Parse(element.GetAttribute("enabled")); if (enabled) { if (name.Length == 0) { throw new ArgumentException("missing name"); } if (element.HasChildNodes) { storage = this.LoadProvider(typeName, element); } else { storage = this.LoadProvider(typeName, (XmlNode)null); } StorageConfiguration.provider = storage; } }
private void InitCommentsView(IFeedStorage storage, Feed feed) { IList<CommentInfo> comments = new List<CommentInfo>(); comments = BuildCommentsList(feed, storage.GetFeedComments(feed.Id)); //AppendChildsComments(ref comments, storage.GetFeedComments(feed.Id)); ConfigureComments(commentList, feed); commentList.Items = comments; commentList.CommentsCountTitle = GetCommentsCount(comments).ToString(CultureInfo.CurrentCulture); commentList.TotalCount = GetCommentsCount(comments); }
// Dependencies can be injected via the constructor public RssCommands(DiscordSocketClient client, ISpeaker speaker, IFeedStorage feedStorage) { _client = client; _speaker = speaker; _feedStorage = feedStorage; }
static StorageConfiguration() { //StorageConfiguration.providers = new HybridDictionary(); provider = null; }