Example #1
0
        public override void LoadSettings(HttpContext context) {
            lock (typeof(UploadedFileHandler)) {
                FeedHandlers = FeedHandlers ?? new XDictionary<string, UploadedFileHandler>();

                if (!_initialized) {
                    var feedPrefixUrl = CloudConfigurationManager.GetSetting("feed-prefix-url");
                    var packagePrefixUrl = CloudConfigurationManager.GetSetting("package-prefix");

                    var twitterHandle = CloudConfigurationManager.GetSetting("tweet-packages");

                    var path = context.Request.CurrentExecutionFilePath;
                    _feedName = Path.GetFileNameWithoutExtension(path).ToLower();
                    if (_feedName != null) {
                        _remoteFeedFilename = (_feedName + ".xml") ?? "current.xml";
                        _localfeedLocation = _remoteFeedFilename.GenerateTemporaryFilename();

                        _canonicalFeedUrl = new Uri(feedPrefixUrl.HttpSlashed(_feedName));
                        _packagePrefixUrl = new Uri(packagePrefixUrl.HttpSlashed());

                        _packageStorageFolder = null; // we don't store packages locally.

                        _tweeter = new Tweeter(twitterHandle);

                        CurrentTask.Events += new DownloadProgress((remoteLocation, location, progress) => {
                        });
                        CurrentTask.Events += new DownloadCompleted((remoteLocation, locallocation) => Logger.Message("Downloaded '{0}' => '{1}'", remoteLocation, locallocation));

                        FeedHandlers.Add(_feedName, this);

                        _initialized = true;
                    }
                }
            }
        }
Example #2
0
        public override void LoadSettings(HttpContext context) {
            lock (this) {
                if (!_initialized) {
                    var twitterHandle = CloudConfigurationManager.GetSetting("tweet-commits");
                    if (!string.IsNullOrEmpty(twitterHandle)) {
                        _tweeter = new Tweeter(twitterHandle);
                    }

                    var aliases = CloudConfigurationManager.GetSetting("github-aliases");

                    foreach (var set in aliases.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Split('=')).Where(set => set.Length == 2)) {
                        _aliases.Add( set[0],set[1]);
                    }

                    _initialized = true;
                }
            }
        }