public SecurityPage([NotNull] FeedBuilder feedBuilder, [NotNull] IOpenPgp openPgp) { InitializeComponent(); _feedBuilder = feedBuilder; _openPgp = openPgp; }
private HttpResponseMessage Search(string key, int page) { var searchResults = this.service.GetSearchResults(key, page); if (searchResults == null) { this.service.CreateSearch(key.ToSearch <TContract>()); searchResults = this.service.GetSearchResults(key, page); } if (searchResults == null) { throw new NotFoundException(string.Format("Search results not found for key {0}/{1}", key, page)); } var feedBuilder = new FeedBuilder() .WithEntityName(this.entityName) .WithId("search") .WithTitle("Search Results") .WithItemTitle(this.entityName) .WithItems(searchResults.Contracts); if (searchResults.NextPage.HasValue) { feedBuilder.AddMoreResultsLink(this.Request.RequestUri, searchResults.SearchResultsKey, searchResults.NextPage); } var feed = feedBuilder.Build(); return(this.Request.CreateResponse(HttpStatusCode.OK, feed, new AtomSyndicationFeedFormatter(), "application/xml")); }
public ArchiveExtractPage([NotNull] FeedBuilder feedBuilder, [CanBeNull] InstallerCapture installerCapture = null) { InitializeComponent(); _feedBuilder = feedBuilder; _installerCapture = installerCapture; }
/// <summary> /// Enables processing of the result of an action method by a custom type that inherits from the <see cref="T:System.Web.Mvc.ActionResult"/> class. /// </summary> /// <param name="context">The context in which the result is executed. The context information includes the controller, HTTP content, request context, and route data.</param> public override void ExecuteResult(ControllerContext context) { context.HttpContext.Response.ContentType = "application/rss+xml"; string format = string.IsNullOrEmpty(Format) ? "rss" : Format.ToLower(); FeedBuilder.Build(Feed, context.HttpContext.Response.Output, format); }
public DownloadPage([NotNull] FeedBuilder feedBuilder, [NotNull] InstallerCapture installerCapture) { InitializeComponent(); _feedBuilder = feedBuilder; _installerCapture = installerCapture; }
public InstallerCaptureDiffPage([NotNull] InstallerCapture installerCapture, [NotNull] FeedBuilder feedBuilder) { InitializeComponent(); _installerCapture = installerCapture; _feedBuilder = feedBuilder; }
/// <summary> /// Returns a list of the entities as an Atom XML feed /// </summary> /// <returns>Reponse with appropriate status code and the Atom XML feed as content</returns> public HttpResponseMessage Get() { return(WebHandler(() => { List <TContract> list; using (var scope = new TransactionScope(TransactionScopeOption.Required, ReadOptions())) { // TODO: Constrain the identifiers we retrieve or have an enum to allow this e.g. Nexus, Originating, Default, All list = new List <TContract>(this.service.List()); scope.Complete(); } var entityName = typeof(TContract).Name.ToLowerInvariant(); var feed = new FeedBuilder() .WithEntityName(entityName) .WithId("list") .WithTitle("All") .WithItemTitle(entityName) .WithItems(list) .Build(); return this.Request.CreateResponse(HttpStatusCode.OK, feed, new AtomSyndicationFeedFormatter(), "application/xml"); })); }
public FeedBuilderTests() { _config = new TestConfiguration(); _builder = new FeedBuilder(_config); _config.Title = "Rosanna"; _config.Url = "http://example.com"; _config.Author = "Author"; _feed = _builder.GetFeed(new ArticleRepository(_config, new PathResolver(_config)).GetArticles()); }
public static CaptureSession Start([NotNull] FeedBuilder feedBuilder) { #region Sanity checks if (feedBuilder == null) { throw new ArgumentNullException("feedBuilder"); } #endregion return(new CaptureSession(Snapshot.Take(), feedBuilder)); }
public static CaptureSession Load([NotNull] string path, [NotNull] FeedBuilder feedBuilder) { #region Sanity checks if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } if (feedBuilder == null) { throw new ArgumentNullException("feedBuilder"); } #endregion return(new CaptureSession(BinaryStorage.LoadBinary <Snapshot>(path), feedBuilder)); }
public SyndicationFeed LoadFeed() { var syndicationItems = _assemblies .SelectMany(LoadSyndicationItemsFromAssembly) .OrderByDescending(p => p.PublishDate) .ToArray(); var feed = new FeedBuilder().Build(_feedSettings, syndicationItems); foreach (var item in syndicationItems) { item.SourceFeed = feed; } return(feed); }
/// <summary> /// Tries extracting the installer as an <see cref="Archive"/>. /// </summary> /// <param name="feedBuilder">All collected data is stored into this builder.</param> /// <param name="handler">A callback object used when the the user is to be informed about progress.</param> /// <exception cref="OperationCanceledException">The user canceled the task.</exception> /// <exception cref="IOException">The installer could not be extracted as an archive.</exception> /// <exception cref="UnauthorizedAccessException">Read or write access to a temporary file is not permitted.</exception> public void ExtractInstallerAsArchive(FeedBuilder feedBuilder, ITaskHandler handler) { if (string.IsNullOrEmpty(_localPath) || _url == null) { throw new InvalidOperationException(); } var archive = new Archive { Href = _url, MimeType = _localPath.EndsWith(@".msi") ? Archive.MimeTypeMsi // 7zip's extraction logic can handle a number of self-extracting formats : Archive.MimeType7Z }; feedBuilder.RetrievalMethod = archive; feedBuilder.TemporaryDirectory = archive.ToTempDir(handler, _localPath); }
/// <summary> /// Convert this to a feed. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="author"></param> /// <param name="description"></param> /// <param name="title"></param> /// <param name="uri">The uri of the request</param> public static SyndicationFeed AsFeed <T>(Uri uri, string author, string title, string description) { IEntityService <T> service = EntityRegistration.GetService <T>(); IList <IPublishable> entries = service.GetRecentAs <IPublishable>(1, 20); //http://localhost:49739/Post/rss/ string host = uri.Host; if (host.Contains("localhost")) { host = "http://localhost.com"; } else { host = uri.AbsoluteUri; } var feed = FeedBuilder.Build(author, title, description, host, entries); return(feed); }
private ExitCode Finish() { if (_additionalArgs.Count != 3) { return(PrintHelp()); } string snapshotFile = _additionalArgs[1]; string feedFile = _additionalArgs[2]; if (FileExists(feedFile)) { return(ExitCode.IOError); } var feedBuilder = new FeedBuilder(); var session = CaptureSession.Load(snapshotFile, feedBuilder); session.InstallationDir = _installationDirectory; session.Diff(_handler); feedBuilder.MainCandidate = string.IsNullOrEmpty(_mainExe) ? feedBuilder.Candidates.FirstOrDefault() : feedBuilder.Candidates.FirstOrDefault(x => StringUtils.EqualsIgnoreCase(FileUtils.UnifySlashes(x.RelativePath), _mainExe)); session.Finish(); if (!string.IsNullOrEmpty(_zipFile)) { if (FileExists(_zipFile)) { return(ExitCode.IOError); } var relativeUri = new Uri(Path.GetFullPath(feedFile)).MakeRelativeUri(new Uri(Path.GetFullPath(_zipFile))); session.CollectFiles(_zipFile, relativeUri, _handler); Log.Warn("If you wish to upload this feed and ZIP archive, make sure to turn the <archive>'s relative href into an absolute one."); } feedBuilder.Build().Save(feedFile); return(ExitCode.OK); }
/// <summary> /// Returns all the mappings for the entity as an Atom XML feed /// </summary> /// <param name="id">The MDM identifier for the entity</param> /// <param name="etag">The current version held by the client</param> /// <returns>Response with approrpiate status code and the Atom feed as content</returns> public HttpResponseMessage Get(int id, [IfNoneMatch] ETag etag) { return(WebHandler(() => { var request = MessageFactory.GetRequest(QueryParameters); request.EntityId = id; request.Version = etag.ToVersion(); ContractResponse <TContract> response; using (var scope = new TransactionScope(TransactionScopeOption.Required, ReadOptions())) { response = service.Request(request); scope.Complete(); } if (!response.IsValid) { throw new MdmFaultException(new GetRequestFaultHandler().Create(typeof(TContract).Name, response.Error, request)); } var entityName = typeof(TContract).Name.ToLowerInvariant(); var title = string.Format("Mappings for {0} {1} ", entityName, id); var feed = new FeedBuilder() .WithEntityName(entityName) .WithId(id.ToString()) .WithTitle(title) .WithItemTitle("mapping") .WithItems(response.Contract.Identifiers) .Build(); return Request.CreateResponse(HttpStatusCode.OK, feed, new AtomSyndicationFeedFormatter(), "application/xml"); })); }
private ExitCode Finish() { if (_additionalArgs.Count != 3) return PrintHelp(); string snapshotFile = _additionalArgs[1]; string feedFile = _additionalArgs[2]; if (FileExists(feedFile)) return ExitCode.IOError; var feedBuilder = new FeedBuilder(); var session = CaptureSession.Load(snapshotFile, feedBuilder); session.InstallationDir = _installationDirectory; session.Diff(_handler); feedBuilder.MainCandidate = string.IsNullOrEmpty(_mainExe) ? feedBuilder.Candidates.FirstOrDefault() : feedBuilder.Candidates.FirstOrDefault(x => StringUtils.EqualsIgnoreCase(FileUtils.UnifySlashes(x.RelativePath), _mainExe)); session.Finish(); if (!string.IsNullOrEmpty(_zipFile)) { if (FileExists(_zipFile)) return ExitCode.IOError; var relativeUri = new Uri(Path.GetFullPath(feedFile)).MakeRelativeUri(new Uri(Path.GetFullPath(_zipFile))); session.CollectFiles(_zipFile, relativeUri, _handler); Log.Warn("If you wish to upload this feed and ZIP archive, make sure to turn the <archive>'s relative href into an absolute one."); } feedBuilder.Build().Save(feedFile); return ExitCode.OK; }
static void Main(string[] args) { FeedBuilder fb = new FeedBuilder(); fb.Build(); }
public FeedCooker(FeedBuilder feedBuilder) { _feedBuilder = feedBuilder; }
private CaptureSession([NotNull] Snapshot snapshotBefore, [NotNull] FeedBuilder feedBuilder) { _snapshot = snapshotBefore; _feedBuilder = feedBuilder; }
/// <summary> /// Captures the current system state as a snapshot of the system state before the target application was installed. /// </summary> /// <param name="feedBuilder">All collected data is stored into this builder. You can perform additional modifications before using <see cref="FeedBuilder.Build"/> to get a feed.</param> /// <exception cref="IOException">There was an error accessing the registry or file system.</exception> /// <exception cref="UnauthorizedAccessException">Access to the registry or the file system was not permitted.</exception> public static CaptureSession Start(FeedBuilder feedBuilder) => new(
public EntryPointPage([NotNull] FeedBuilder feedBuilder) { InitializeComponent(); _feedBuilder = feedBuilder; }
private CaptureSession(Snapshot snapshotBefore, FeedBuilder feedBuilder) { _snapshot = snapshotBefore; _feedBuilder = feedBuilder; }
public DetailsPage([NotNull] FeedBuilder feedBuilder) { InitializeComponent(); _feedBuilder = feedBuilder; }