Пример #1
0
        public TweetPicTask(int wallId)
        {
            using (var db = new MySelfieEntities())
            {
                var entity = db.Walls.Single(x => x.WallId == wallId);

                this._model = new WallModel(entity);

                this._pullLastID = db.Photos
                    .Where(x => x.WallId == wallId)
                    .OrderByDescending(x => x.SocialID)
                    .Select(x => x.SocialID)
                    .FirstOrDefault()
                    .IfNotNull(x => x, 0);
            }

            this.LastCommandTime = DateTime.Now;

            this.setTwitterCredentials(this._model);

            this._startTime = DateTime.Now;

            this._pullDelayMilliseconds = 10000;
            this._pullMaxAmount = 100;

            this._isStreaming = false;
            this._keepPulling = true;

            if (this._isStreaming)
            {
                this.configureStream();
            }

            this._processingThreadList = new List<Thread>();
            this._currentProcesses = 0;
            this._finishedProcesses = 0;
            this._processNotificationFrequency = 500;   // how often system will log activity

            this._errorCount = 0;
            this._totalSkippedPull = 0;
            this._totalNewPulled = 0;
            this._totalPulls = 0;
            this._totalRecievedPull = 0;
            this._pullNotificationFrequency = 10;   // how often system will log activity

            this._tweetRepo = new TweetPicRepository(this._model.WallId);
        }
Пример #2
0
        public InstagramPicTask(int wallId)
        {
            using (var db = new MySelfieEntities())
            {
                var entity = db.Walls.Single(x => x.WallId == wallId);

                this._model = new WallModel(entity);

                this._pullLastID = db.Photos
                    .Where(x => x.WallId == wallId)
                    .OrderByDescending(x => x.SocialID)
                    .Select(x => x.SocialID)
                    .FirstOrDefault()
                    .IfNotNull(x => x, 0);
            }

            if (this._model.Instagram_AccessToken.IsEmptyOrNull())
            {
                this._model.Instagram_AccessToken = "1545103628.1fb234f.e6f242fd81fe48c1a156444871e803b3";  // TESTING
            }

            this.LastCommandTime = DateTime.Now;

            this._startTime = DateTime.Now;

            this._pullDelayMilliseconds = 10000;
            this._pullMaxAmount = 100;
            this._keepPulling = true;

            this._processingThreadList = new List<Thread>();
            this._currentProcesses = 0;
            this._finishedProcesses = 0;
            this._processNotificationFrequency = 100;   // how often system will log activity

            this._errorCount = 0;
            this._totalSkippedPull = 0;
            this._totalNewPulled = 0;
            this._totalPulls = 0;
            this._totalRecievedPull = 0;
            this._pullNotificationFrequency = 10;   // how often system will log activity

            this._repo = new InstagramPicRepository(this.WallId);
        }
Пример #3
0
 private void setTwitterCredentials(WallModel model)
 {
     TwitterCredentials.SetCredentials(this.getTwitterCredentials(this._model));
 }
Пример #4
0
        private IOAuthCredentials getTwitterCredentials(WallModel model)
        {
            string consumerKey = model.Twitter_ConsumerKey.Trim();
            string consumerSecret = model.Twitter_ConsumerSecret.Trim();
            string userTokenKey = model.Twitter_UserTokenKey.Trim();
            string userTokenSecret = model.Twitter_UserTokenSecret.Trim();

            return TwitterCredentials.CreateCredentials(userTokenKey, userTokenSecret, consumerKey, consumerSecret);
        }