コード例 #1
0
        /// <summary>
        /// Creates a new interface dialog.
        /// </summary>
        /// <param name="interfaceUri">The interface to modify the preferences for.</param>
        /// <param name="solveCallback">Called after <see cref="InterfacePreferences"/> have been changed and the <see cref="ISolver"/> needs to be rerun.</param>
        /// <param name="feedManager">The feed manager used to retrieve feeds for additional information about implementations.</param>
        private InterfaceDialog(FeedUri interfaceUri, Func <Selections> solveCallback, IFeedManager feedManager)
        {
            #region Sanity checks
            if (interfaceUri == null)
            {
                throw new ArgumentNullException(nameof(interfaceUri));
            }
            if (solveCallback == null)
            {
                throw new ArgumentNullException(nameof(solveCallback));
            }
            if (feedManager == null)
            {
                throw new ArgumentNullException(nameof(feedManager));
            }
            #endregion

            InitializeComponent();
            comboBoxStability.Items.AddRange(new object[] { Resources.UseDefaultSetting, Stability.Stable, Stability.Testing, Stability.Developer });
            dataColumnUserStability.Items.AddRange(Stability.Unset, Stability.Preferred, Stability.Stable, Stability.Testing, Stability.Developer, Stability.Buggy, Stability.Insecure);

            _interfaceUri  = interfaceUri;
            _mainFeed      = feedManager[_interfaceUri];
            _solveCallback = solveCallback;
            _feedManager   = feedManager;
        }
コード例 #2
0
        /// <summary>
        /// Creates a new tile manager.
        /// </summary>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="catalogManager">Provides access to remote and local <see cref="Catalog"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="tileListMyApps">The <see cref="IAppTileList"/> used to represent the "my apps" <see cref="AppList"/>.</param>
        /// <param name="tileListCatalog">The <see cref="IAppTileList"/> used to represent the merged <see cref="Catalog"/>.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        public AppTileManagement([NotNull] IFeedManager feedManager, [NotNull] ICatalogManager catalogManager, [NotNull] IAppTileList tileListMyApps, [NotNull] IAppTileList tileListCatalog, bool machineWide)
        {
            #region Sanity checks
            if (feedManager == null)
            {
                throw new ArgumentNullException("feedManager");
            }
            if (catalogManager == null)
            {
                throw new ArgumentNullException("catalogManager");
            }
            if (tileListMyApps == null)
            {
                throw new ArgumentNullException("tileListMyApps");
            }
            if (tileListCatalog == null)
            {
                throw new ArgumentNullException("tileListCatalog");
            }
            #endregion

            _feedManager    = feedManager;
            _catalogManager = catalogManager;

            _tileListMyApps  = tileListMyApps;
            _tileListCatalog = tileListCatalog;
            _machineWide     = machineWide;
        }
コード例 #3
0
        /// <summary>
        /// Creates a new tile manager.
        /// </summary>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="catalogManager">Provides access to remote and local <see cref="Catalog"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="iconCache">The icon cache used by newly created <see cref="IAppTile"/>s to retrieve application icons.</param>
        /// <param name="tileListMyApps">The <see cref="IAppTileList"/> used to represent the "my apps" <see cref="AppList"/>.</param>
        /// <param name="tileListCatalog">The <see cref="IAppTileList"/> used to represent the merged <see cref="Catalog"/>.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        public AppTileManagement([NotNull] IFeedManager feedManager, [NotNull] ICatalogManager catalogManager, [NotNull] IIconCache iconCache, [NotNull] IAppTileList tileListMyApps, [NotNull] IAppTileList tileListCatalog, bool machineWide)
        {
            #region Sanity checks
            if (feedManager == null)
            {
                throw new ArgumentNullException(nameof(feedManager));
            }
            if (catalogManager == null)
            {
                throw new ArgumentNullException(nameof(catalogManager));
            }
            if (iconCache == null)
            {
                throw new ArgumentNullException(nameof(iconCache));
            }
            if (tileListMyApps == null)
            {
                throw new ArgumentNullException(nameof(tileListMyApps));
            }
            if (tileListCatalog == null)
            {
                throw new ArgumentNullException(nameof(tileListCatalog));
            }
            #endregion

            _feedManager    = feedManager;
            _catalogManager = catalogManager;
            _iconCache      = iconCache;

            _tileListMyApps  = tileListMyApps;
            _tileListCatalog = tileListCatalog;
            _machineWide     = machineWide;
        }
コード例 #4
0
 public CasePostPartDriver(IFeedManager feedManager, IContentManager contentManager, IWorkContextAccessor workContextAccessor, ICommonService commonService)
 {
     _feedManager         = feedManager;
     _contentManager      = contentManager;
     _workContextAccessor = workContextAccessor;
     _commonService       = commonService;
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationFeedManager"/> class.
 /// </summary>
 /// <param name="feedManager">The feed manager.</param>
 /// <param name="feedItemManager">The feed item manager.</param>
 /// <param name="saveUtility">The save utility.</param>
 public ApplicationFeedManager(IFeedManager feedManager, IFeedItemManager feedItemManager, ISavedArticlesManager savedFeedItemManager, ISaveUtility saveUtility)
 {
     _feedManager          = feedManager;
     _feedItemManager      = feedItemManager;
     _savedFeedItemManager = savedFeedItemManager;
     _saveUtility          = saveUtility;
 }
コード例 #6
0
        /// <summary>
        /// Creates a new <see cref="SelectionCandidate"/> provider.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="implementationStore">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        public SelectionCandidateProvider(Config config, IFeedManager feedManager, IImplementationStore implementationStore, IPackageManager packageManager)
        {
            _config = config ?? throw new ArgumentNullException(nameof(config));
            if (feedManager == null)
            {
                throw new ArgumentNullException(nameof(feedManager));
            }
            if (implementationStore == null)
            {
                throw new ArgumentNullException(nameof(implementationStore));
            }
            _packageManager = packageManager ?? throw new ArgumentNullException(nameof(packageManager));

            _interfacePreferences    = new TransparentCache <FeedUri, InterfacePreferences>(InterfacePreferences.LoadForSafe);
            _externalImplementations = new Dictionary <string, ExternalImplementation>();
            _storeContains           = new TransparentCache <ManifestDigest, bool>(implementationStore.Contains);
            _feeds = new TransparentCache <FeedUri, Feed?>(feedUri =>
            {
                try
                {
                    var feed = feedManager[feedUri];
                    if (feed.MinInjectorVersion != null && ImplementationVersion.ZeroInstall < feed.MinInjectorVersion)
                    {
                        Log.Warn($"The Zero Install version is too old. The feed '{feedUri}' requires at least version {feed.MinInjectorVersion} but the installed version is {ImplementationVersion.ZeroInstall}. Try updating Zero Install.");
                        return(null);
                    }
                    return(feed);
                }
                catch (WebException ex)
                {
                    Log.Warn(ex);
                    return(null);
                }
            });
        }
コード例 #7
0
 /// <summary>
 /// See base class.
 /// </summary>
 /// <param name="configuration"></param>
 protected override void DoLoadConfiguration(Configuration configuration)
 {
     base.DoLoadConfiguration(configuration);
     _ReceiverManager = Factory.Singleton.Resolve <IFeedManager>().Singleton;
     _InternetClientCanRequestClosestAircraft = configuration.InternetClientSettings.AllowInternetProximityGadgets;
     _ReceiverId = configuration.GoogleMapSettings.ClosestAircraftReceiverId;
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainFeedViewModel"/> class.
 /// </summary>
 /// <param name="manager">Feed Manager.</param>
 /// <param name="database">Database.</param>
 /// <param name="error">Error Handler.</param>
 /// <param name="navigation">Navigation Handler.</param>
 public MainFeedViewModel(IFeedManager manager, IDatabase database, IErrorHandler error, INavigationHandler navigation)
     : base(database, error, navigation)
 {
     this.manager = manager;
     this.Posts   = new ObservableCollection <Status>();
     this.Title   = "Main Feed";
 }
コード例 #9
0
        /// <summary>
        /// Creates a new <see cref="SelectionCandidate"/> provider.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        public SelectionCandidateProvider([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager)
        {
            #region Sanity checks
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (feedManager == null)
            {
                throw new ArgumentNullException("feedManager");
            }
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }
            #endregion

            _config         = config;
            _isCached       = BuildCacheChecker(store);
            _packageManager = packageManager;
            _comparer       = new TransparentCache <FeedUri, SelectionCandidateComparer>(id => new SelectionCandidateComparer(config, _isCached, _interfacePreferences[id].StabilityPolicy, CultureInfo.CurrentUICulture));
            _feeds          = new TransparentCache <FeedUri, Feed>(feedManager.GetFeed);
        }
コード例 #10
0
    /// <summary>
    /// Temporarily sets <see cref="IFeedManager.Refresh"/> to <c>false</c>.
    /// </summary>
    /// <returns>Call <see cref="IDisposable.Dispose"/> on this to restore the original value of <see cref="IFeedManager.Refresh"/>.</returns>
    public static IDisposable PauseRefresh(this IFeedManager feedManager)
    {
        bool backupRefresh = feedManager.Refresh;

        feedManager.Refresh = false;
        return(new Disposable(() => feedManager.Refresh = backupRefresh));
    }
コード例 #11
0
    /// <summary>
    /// Returns a specific <see cref="Feed"/>. Automatically updates cached feeds when indicated by <see cref="IFeedManager.ShouldRefresh"/>.
    /// </summary>
    /// <param name="feedManager">The <see cref="IFeedManager"/> implementation.</param>
    /// <param name="feedUri">The canonical ID used to identify the feed.</param>
    /// <returns>The normalized <see cref="Feed"/>. Do not modify! The same instance may be returned to future callers.</returns>
    /// <remarks><see cref="Feed"/>s are always served from the <see cref="IFeedCache"/> if possible, unless <see cref="IFeedManager.Refresh"/> is set to <c>true</c>.</remarks>
    /// <exception cref="UriFormatException"><see cref="Feed.Uri"/> is missing or does not match <paramref name="feedUri"/>.</exception>
    /// <exception cref="OperationCanceledException">The user canceled the task.</exception>
    /// <exception cref="IOException">A problem occurred while reading the feed file.</exception>
    /// <exception cref="WebException">A problem occurred while fetching the feed file.</exception>
    /// <exception cref="UnauthorizedAccessException">Access to the cache is not permitted.</exception>
    /// <exception cref="SignatureException">The signature data of a remote feed file could not be verified.</exception>
    /// <exception cref="InvalidDataException">A required property on the feed is not set or invalid.</exception>
    public static Feed GetFresh(this IFeedManager feedManager, FeedUri feedUri)
    {
        #region Sanity checks
        if (feedManager == null)
        {
            throw new ArgumentNullException(nameof(feedManager));
        }
        if (feedUri == null)
        {
            throw new ArgumentNullException(nameof(feedUri));
        }
        #endregion

        var feed = feedManager[feedUri];

        if (!feedManager.Refresh && feedManager.ShouldRefresh)
        {
            feedManager.Stale   = false;
            feedManager.Refresh = true;
            try
            {
                feed = feedManager[feedUri];
            }
            catch (Exception ex) when(ex is WebException or IOException or UnauthorizedAccessException)
            {
                Log.Warn(ex);
            }
            finally
            {
                feedManager.Refresh = false;
            }
        }

        return(feed);
    }
コード例 #12
0
        /// <summary>
        /// Creates a new <see cref="SelectionCandidate"/> provider.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        /// <param name="languages">The preferred languages for the implementation.</param>
        public SelectionCandidateProvider([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager, [NotNull] LanguageSet languages)
        {
            #region Sanity checks
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (feedManager == null)
            {
                throw new ArgumentNullException(nameof(feedManager));
            }
            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }
            if (packageManager == null)
            {
                throw new ArgumentNullException(nameof(packageManager));
            }
            if (languages == null)
            {
                throw new ArgumentNullException(nameof(languages));
            }
            #endregion

            _config         = config;
            _feedManager    = feedManager;
            _isCached       = BuildCacheChecker(store);
            _packageManager = packageManager;
            _comparer       = new TransparentCache <FeedUri, SelectionCandidateComparer>(id => new SelectionCandidateComparer(config, _isCached, _interfacePreferences[id].StabilityPolicy, languages));
        }
コード例 #13
0
        /// <summary>
        /// Creates a new simple solver.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param>
        public BacktrackingSolver([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager, [NotNull] ITaskHandler handler)
        {
            #region Sanity checks
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (feedManager == null)
            {
                throw new ArgumentNullException("feedManager");
            }
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            #endregion

            _config         = config;
            _store          = store;
            _packageManager = packageManager;
            _feedManager    = feedManager;
            _handler        = handler;
        }
コード例 #14
0
 public FeedRegistrationViewHandler(
     IFeedManager feedManager,
     IMechanicsService mechanics
     )
 {
     _feedManager = feedManager;
     _mechanics = mechanics;
 }
コード例 #15
0
ファイル: FeedManagerTests.cs プロジェクト: vishalishere/vrs
        public void FeedManager_Constructor_Initialises_To_Known_Value_And_Properties_Work()
        {
            _Manager.Dispose();
            _Manager = Factory.Singleton.Resolve <IFeedManager>();

            Assert.AreEqual(0, _Manager.Feeds.Length);
            Assert.AreEqual(0, _Manager.VisibleFeeds.Length);
        }
コード例 #16
0
ファイル: StatisticsView.cs プロジェクト: ts295983632/vrs
        public StatisticsView()
        {
            _FeedManager = Factory.ResolveSingleton <IFeedManager>();

            AdsbMessageTypeCount   = new long[256];
            ModeSDFStatistics      = new ModeSDFStatistics[32];
            AdsbMessageFormatCount = new long[Enum.GetValues(typeof(MessageFormat)).OfType <MessageFormat>().Select(r => (int)r).Max() + 1];
        }
コード例 #17
0
 public BlogController(IOrchardServices services, IBlogService blogService, IBlogSlugConstraint blogSlugConstraint, IFeedManager feedManager, RouteCollection routeCollection) {
     _services = services;
     _blogService = blogService;
     _blogSlugConstraint = blogSlugConstraint;
     _feedManager = feedManager;
     _routeCollection = routeCollection;
     Logger = NullLogger.Instance;
 }
コード例 #18
0
 public FeedRegistrationViewHandler(
     IFeedManager feedManager,
     IMechanicsService mechanics
     )
 {
     _feedManager = feedManager;
     _mechanics   = mechanics;
 }
コード例 #19
0
 public FeedFilter(
     IFeedManager feedManager, 
     IWorkContextAccessor workContextAccessor, 
     IShapeFactory shapeFactory) {
     _feedManager = feedManager;
     _workContextAccessor = workContextAccessor;
     Shape = shapeFactory;
 }
コード例 #20
0
 public static async Task SendPongRequestAsync(this IFeedManager subscriptionManager, MessageContext <PingMessage> context)
 {
     var request = new PongRequest()
     {
         Timestamp = context.Message.Timestamp
     };
     await subscriptionManager.SendAsync(context.Next <IWebSocketRequest>(request), CancellationToken.None);
 }
コード例 #21
0
 public static void Register(this IFeedManager feedManager, BlogPart blogPart)
 {
     feedManager.Register(blogPart.Name, "rss", new RouteValueDictionary {
         { "containerid", blogPart.Id }
     });
     feedManager.Register(blogPart.Name + " - Comments", "rss", new RouteValueDictionary {
         { "commentedoncontainer", blogPart.Id }
     });
 }
コード例 #22
0
 public SidebarDashboardDriver(
     ICRMContentOwnershipService crmContentOwnershipService,
     IContentDefinitionManager contentDefinitionManager,
     IOrchardServices orchardServices,
     ISiteService siteService,
     IFeedManager feedManager, IContainerService containerService)
     : base(crmContentOwnershipService, contentDefinitionManager, orchardServices, siteService, feedManager, containerService)
 {
 }
コード例 #23
0
 public FeedFilter(
     IFeedManager feedManager,
     IWorkContextAccessor workContextAccessor,
     IShapeFactory shapeFactory)
 {
     _feedManager         = feedManager;
     _workContextAccessor = workContextAccessor;
     Shape = shapeFactory;
 }
コード例 #24
0
        /// <inheritdoc/>
        public void ShowSelections(Selections selections, IFeedManager feedManager)
        {
            #region Sanity checks
            if (selections == null) throw new ArgumentNullException(nameof(selections));
            if (feedManager == null) throw new ArgumentNullException(nameof(feedManager));
            #endregion

            // TODO: Implement
        }
コード例 #25
0
 public FeedItemsProcessor(IFeedManager feedManager,
     IRssManager rssManager,
     IAuthentication authentication,
     FeedHubClient feedHubClient)
 {
     _feedManager = feedManager;
     _rssManager = rssManager;
     _authentication = authentication;
     _feedHubClient = feedHubClient;
 }
コード例 #26
0
 /// <summary>
 /// Creates a new external JSON solver.
 /// </summary>
 /// <param name="backingSolver">An internal solver used to find an implementation of the external solver.</param>
 /// <param name="selectionsManager">Used to check whether the external solver is already in the cache.</param>
 /// <param name="fetcher">Used to download implementations of the external solver.</param>
 /// <param name="executor">Used to launch the external solver.</param>
 /// <param name="externalSolverUri">The feed URI used to get the external solver.</param>
 /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
 /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param>
 public ExternalSolver(ISolver backingSolver, ISelectionsManager selectionsManager, IFetcher fetcher, IExecutor executor, FeedUri externalSolverUri, IFeedManager feedManager, ITaskHandler handler)
 {
     _backingSolver      = backingSolver ?? throw new ArgumentNullException(nameof(backingSolver));
     _selectionsManager  = selectionsManager ?? throw new ArgumentNullException(nameof(selectionsManager));
     _fetcher            = fetcher ?? throw new ArgumentNullException(nameof(fetcher));
     _executor           = executor ?? throw new ArgumentNullException(nameof(executor));
     _feedManager        = feedManager ?? throw new ArgumentNullException(nameof(feedManager));
     _handler            = handler ?? throw new ArgumentNullException(nameof(handler));
     _solverRequirements = new Requirements(externalSolverUri ?? throw new ArgumentNullException(nameof(externalSolverUri)));
 }
コード例 #27
0
        /// <summary>
        /// Creates a new tile manager.
        /// </summary>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="catalogManager">Provides access to remote and local <see cref="Catalog"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="iconStore">The icon store used by newly created <see cref="IAppTile"/>s to retrieve application icons.</param>
        /// <param name="tileListMyApps">The <see cref="IAppTileList"/> used to represent the "my apps" <see cref="AppList"/>.</param>
        /// <param name="tileListCatalog">The <see cref="IAppTileList"/> used to represent the merged <see cref="Catalog"/>.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        public AppTileManagement(IFeedManager feedManager, ICatalogManager catalogManager, IIconStore iconStore, IAppTileList tileListMyApps, IAppTileList tileListCatalog, bool machineWide)
        {
            _feedManager    = feedManager ?? throw new ArgumentNullException(nameof(feedManager));
            _catalogManager = catalogManager ?? throw new ArgumentNullException(nameof(catalogManager));
            _iconStore      = iconStore ?? throw new ArgumentNullException(nameof(iconStore));

            _tileListMyApps  = tileListMyApps ?? throw new ArgumentNullException(nameof(tileListMyApps));
            _tileListCatalog = tileListCatalog ?? throw new ArgumentNullException(nameof(tileListCatalog));
            _machineWide     = machineWide;
        }
コード例 #28
0
 public BlogPostController(
     IOrchardServices services, 
     IBlogService blogService, 
     IBlogPostService blogPostService,
     IFeedManager feedManager) {
     _services = services;
     _blogService = blogService;
     _blogPostService = blogPostService;
     _feedManager = feedManager;
     T = NullLocalizer.Instance;
 }
コード例 #29
0
        public FeedManagerTest()
        {
            _feedCacheMock    = CreateMock <IFeedCache>();
            _trustManagerMock = CreateMock <ITrustManager>();
            _feedManager      = new FeedManager(_config, _feedCacheMock.Object, _trustManagerMock.Object, new SilentTaskHandler());

            _feedPreNormalize = FeedTest.CreateTestFeed();

            _feedPostNormalize = _feedPreNormalize.Clone();
            _feedPostNormalize.Normalize(_feedPreNormalize.Uri);
        }
コード例 #30
0
 public GenericDashboardDriver(
     IContentDefinitionManager contentDefinitionManager,
     IOrchardServices orchardServices,
     ICRMContentOwnershipService crmContentOwnershipService,
     ISiteService siteService,
     IFeedManager feedManager, IContainerService containerService)
     : base(crmContentOwnershipService, contentDefinitionManager, orchardServices, siteService, feedManager, containerService)
 {
     // display all  the items in the Dashboard
     pageSize = -1;
 }
コード例 #31
0
    /// <summary>
    /// Creates a new <see cref="SelectionCandidate"/> provider.
    /// </summary>
    /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
    /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
    /// <param name="implementationStore">Used to check which <see cref="Implementation"/>s are already cached.</param>
    /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
    public SelectionCandidateProvider(Config config, IFeedManager feedManager, IImplementationStore implementationStore, IPackageManager packageManager)
    {
        _config         = config ?? throw new ArgumentNullException(nameof(config));
        _feedManager    = feedManager ?? throw new ArgumentNullException(nameof(feedManager));
        _packageManager = packageManager ?? throw new ArgumentNullException(nameof(packageManager));

        if (implementationStore == null)
        {
            throw new ArgumentNullException(nameof(implementationStore));
        }
        _storeContains = new(implementationStore.Contains);
    }
コード例 #32
0
ファイル: Program.cs プロジェクト: gelcen/InfotecsTask
        private static void Initialize()
        {
            _linksReader   = new LinksReader();
            _messageWriter = new ConsoleMessageWriter();
            _feedManager   = new FeedManager(_linksReader, _messageWriter);

            _commands = new Dictionary <string, Action>();
            _commands.Add("remove", () => _feedManager.RemoveFeeds());
            _commands.Add("pull", () => _feedManager.SaveFeeds());
            _commands.Add("list", new Action(List));
            _commands.Add("help", new Action(Help));
        }
コード例 #33
0
 public ItemController(
     IContentManager contentManager,
     IShapeFactory shapeFactory,
     ISiteService siteService,
     IFeedManager feedManager)
 {
     _contentManager = contentManager;
     _siteService    = siteService;
     _feedManager    = feedManager;
     Shape           = shapeFactory;
     T = NullLocalizer.Instance;
 }
コード例 #34
0
ファイル: ItemController.cs プロジェクト: sjbisch/Orchard
        public ItemController(
            IContentManager contentManager, 
            IShapeFactory shapeFactory,
            ISiteService siteService,
            IFeedManager feedManager) {

            _contentManager = contentManager;
            _siteService = siteService;
            _feedManager = feedManager;
            Shape = shapeFactory;
            T = NullLocalizer.Instance;
        }
コード例 #35
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void Initialise(IWebSiteProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }
            Provider = provider;

            _SharedConfiguration = Factory.Singleton.Resolve <ISharedConfiguration>().Singleton;
            _FeedManager         = Factory.Singleton.Resolve <IFeedManager>().Singleton;
            _EmptyAircraftList   = Factory.Singleton.Resolve <ISimpleAircraftList>();
        }
コード例 #36
0
        /// <summary>
        /// Creates a new selections manager
        /// </summary>
        /// <param name="feedManager">Used to load <see cref="Feed"/>s containing the original <see cref="Implementation"/>s.</param>
        /// <param name="store">The locations to search for cached <see cref="Implementation"/>s.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        public SelectionsManager([NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager)
        {
            #region Sanity checks
            if (feedManager == null) throw new ArgumentNullException(nameof(feedManager));
            if (store == null) throw new ArgumentNullException(nameof(store));
            if (packageManager == null) throw new ArgumentNullException(nameof(packageManager));
            #endregion

            _feedManager = feedManager;
            _store = store;
            _packageManager = packageManager;
        }
コード例 #37
0
ファイル: ProgressForm.cs プロジェクト: 0install/0install-win
        /// <summary>
        /// Shows the user the <see cref="Selections"/> made by the <see cref="ISolver"/>.
        /// Returns immediately.
        /// </summary>
        /// <param name="selections">The <see cref="Selections"/> as provided by the <see cref="ISolver"/>.</param>
        /// <param name="feedManager">The feed manager used to retrieve feeds for additional information about implementations.</param>
        /// <exception cref="InvalidOperationException">The value is set from a thread other than the UI thread.</exception>
        /// <remarks>This method must not be called from a background thread.</remarks>
        public void ShowSelections(Selections selections, IFeedManager feedManager)
        {
            #region Sanity checks
            if (selections == null) throw new ArgumentNullException(nameof(selections));
            if (feedManager == null) throw new ArgumentNullException(nameof(feedManager));
            if (InvokeRequired) throw new InvalidOperationException("Method called from a non UI thread.");
            #endregion

            taskControl.Visible = false;
            _selectionsShown = selectionsControl.Visible = true;
            selectionsControl.SetSelections(selections, feedManager);
        }
コード例 #38
0
        public ItemController(
            IContentManager contentManager, 
            IContainersPathConstraint containersPathConstraint, 
            IShapeFactory shapeFactory,
            ISiteService siteService,
            IFeedManager feedManager) {

            _contentManager = contentManager;
            _containersPathConstraint = containersPathConstraint;
            _siteService = siteService;
            _feedManager = feedManager;
            Shape = shapeFactory;
        }
コード例 #39
0
 public BlogPostController(
     IOrchardServices services, 
     IBlogService blogService, 
     IBlogPostService blogPostService,
     IFeedManager feedManager,
     IShapeFactory shapeFactory) {
     _services = services;
     _blogService = blogService;
     _blogPostService = blogPostService;
     _feedManager = feedManager;
     T = NullLocalizer.Instance;
     Shape = shapeFactory;
 }
コード例 #40
0
        public static Task SendDataSubscribeRequestAsync(
            this IFeedManager subscriptionManager,
            MessageContext <TranslationSubscriptionRequest <TranslationState> > messageContext,
            CancellationToken cancellationToken
            )
        {
            var request = new DataSubscribeRequest()
            {
                TranslationId = messageContext.Message.Id, LastEventNumber = messageContext.Message.State.LastDataMessageId
            };

            return(subscriptionManager.SendAsync(messageContext.Next <IWebSocketRequest>(request), cancellationToken));
        }
コード例 #41
0
        //--------------------//

        #region Selections
        /// <summary>
        /// Shows the user the <see cref="Selections"/> made by the <see cref="ISolver"/>.
        /// </summary>
        /// <param name="selections">The <see cref="Selections"/> as provided by the <see cref="ISolver"/>.</param>
        /// <param name="feedManager">The feed manager used to retrieve feeds for additional information about implementations.</param>
        /// <remarks>
        ///   <para>This method must not be called from a background thread.</para>
        ///   <para>This method must not be called before <see cref="Control.Handle"/> has been created.</para>
        /// </remarks>
        public void SetSelections([NotNull] Selections selections, [NotNull] IFeedManager feedManager)
        {
            #region Sanity checks
            if (selections == null) throw new ArgumentNullException(nameof(selections));
            if (InvokeRequired) throw new InvalidOperationException("Method called from a non UI thread.");
            #endregion

            _selections = selections;
            _feedManager = feedManager;

            BuildTable();
            if (_solveCallback != null) CreateLinkLabels();
        }
コード例 #42
0
        public static Task SendDataUnsubscribeRequestAsync(
            this IFeedManager subscriptionManager,
            MessageContext <TranslationUnsubscriptionRequest> messageContext,
            CancellationToken cancellationToken
            )
        {
            var request = new DataUnsubscribeRequest()
            {
                TranslationId = messageContext.Message.Id
            };

            return(subscriptionManager.SendAsync(messageContext.Next <IWebSocketRequest>(request), cancellationToken));
        }
コード例 #43
0
        /// <summary>
        /// Creates a new Python solver.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="feedCache">The underlying cache backing the <paramref name="feedManager"/>.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param>
        public PythonSolver([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IFeedCache feedCache, [NotNull] ITaskHandler handler)
        {
            #region Sanity checks
            if (config == null) throw new ArgumentNullException("config");
            if (feedManager == null) throw new ArgumentNullException("feedManager");
            if (feedCache == null) throw new ArgumentNullException("feedCache");
            if (handler == null) throw new ArgumentNullException("handler");
            #endregion

            _config = config;
            _feedManager = feedManager;
            _feedCache = feedCache;
            _handler = handler;
        }
コード例 #44
0
 public TimetableAppointmentController(
     IOrchardServices services, 
     ITimetableService TimetableService, 
     ITimetableAppointmentService TimetableAppointmentService,
     IFeedManager feedManager,
     IShapeFactory shapeFactory,
     IAuthenticationService authService) {
     _services = services;
     _TimetableService = TimetableService;
     _TimetableAppointmentService = TimetableAppointmentService;
     _feedManager = feedManager;
     _authService = authService;
     T = NullLocalizer.Instance;
     Shape = shapeFactory;
 }
コード例 #45
0
 public BlogController(
     IOrchardServices services, 
     IBlogService blogService,
     IBlogPostService blogPostService,
     IFeedManager feedManager, 
     IShapeFactory shapeFactory,
     ISiteService siteService) {
     _services = services;
     _blogService = blogService;
     _blogPostService = blogPostService;
     _feedManager = feedManager;
     _siteService = siteService;
     Logger = NullLogger.Instance;
     Shape = shapeFactory;
 }
コード例 #46
0
 public HomeController(
     ITaxonomyService taxonomyService, 
     IContentManager contentManager, 
     IShapeFactory shapeFactory,
     ISiteService siteService,
     ITermPathConstraint termPathConstraint,
     IFeedManager feedManager)
 {
     _taxonomyService = taxonomyService;
     _contentManager = contentManager;
     _siteService = siteService;
     _termPathConstraint = termPathConstraint;
     _feedManager = feedManager;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
コード例 #47
0
        /// <summary>
        /// Creates a new <see cref="SelectionCandidate"/> provider.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        /// <param name="languages">The preferred languages for the implementation.</param>
        public SelectionCandidateProvider([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager, [NotNull] LanguageSet languages)
        {
            #region Sanity checks
            if (config == null) throw new ArgumentNullException(nameof(config));
            if (feedManager == null) throw new ArgumentNullException(nameof(feedManager));
            if (store == null) throw new ArgumentNullException(nameof(store));
            if (packageManager == null) throw new ArgumentNullException(nameof(packageManager));
            if (languages == null) throw new ArgumentNullException(nameof(languages));
            #endregion

            _config = config;
            _feedManager = feedManager;
            _isCached = BuildCacheChecker(store);
            _packageManager = packageManager;
            _comparer = new TransparentCache<FeedUri, SelectionCandidateComparer>(id => new SelectionCandidateComparer(config, _isCached, _interfacePreferences[id].StabilityPolicy, languages));
        }
コード例 #48
0
        /// <summary>
        /// Creates a new simple solver.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param>
        public BacktrackingSolver([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager, [NotNull] ITaskHandler handler)
        {
            #region Sanity checks
            if (config == null) throw new ArgumentNullException(nameof(config));
            if (feedManager == null) throw new ArgumentNullException(nameof(feedManager));
            if (store == null) throw new ArgumentNullException(nameof(store));
            if (packageManager == null) throw new ArgumentNullException(nameof(packageManager));
            if (handler == null) throw new ArgumentNullException(nameof(handler));
            #endregion

            _config = config;
            _store = store;
            _packageManager = packageManager;
            _feedManager = feedManager;
            _handler = handler;
        }
コード例 #49
0
        public ForumController(IOrchardServices orchardServices, 
            IForumService forumService,
            IForumPathConstraint forumPathConstraint,
            IThreadService threadService,
            ISiteService siteService,
            IShapeFactory shapeFactory,
            IFeedManager feedManager)
        {
            _orchardServices = orchardServices;
            _forumService = forumService;
            _forumPathConstraint = forumPathConstraint;
            _threadService = threadService;
            _siteService = siteService;
            _feedManager = feedManager;

            T = NullLocalizer.Instance;
            Shape = shapeFactory;
        }
コード例 #50
0
        /// <summary>
        /// Creates a new tile manager.
        /// </summary>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="catalogManager">Provides access to remote and local <see cref="Catalog"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="iconCache">The icon cache used by newly created <see cref="IAppTile"/>s to retrieve application icons.</param>
        /// <param name="tileListMyApps">The <see cref="IAppTileList"/> used to represent the "my apps" <see cref="AppList"/>.</param>
        /// <param name="tileListCatalog">The <see cref="IAppTileList"/> used to represent the merged <see cref="Catalog"/>.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        public AppTileManagement([NotNull] IFeedManager feedManager, [NotNull] ICatalogManager catalogManager, [NotNull] IIconCache iconCache, [NotNull] IAppTileList tileListMyApps, [NotNull] IAppTileList tileListCatalog, bool machineWide)
        {
            #region Sanity checks
            if (feedManager == null) throw new ArgumentNullException(nameof(feedManager));
            if (catalogManager == null) throw new ArgumentNullException(nameof(catalogManager));
            if (iconCache == null) throw new ArgumentNullException(nameof(iconCache));
            if (tileListMyApps == null) throw new ArgumentNullException(nameof(tileListMyApps));
            if (tileListCatalog == null) throw new ArgumentNullException(nameof(tileListCatalog));
            #endregion

            _feedManager = feedManager;
            _catalogManager = catalogManager;
            _iconCache = iconCache;

            _tileListMyApps = tileListMyApps;
            _tileListCatalog = tileListCatalog;
            _machineWide = machineWide;
        }
コード例 #51
0
ファイル: RunHook.cs プロジェクト: 0install/0install-win
        /// <summary>
        /// Hooks into the creation of new processes on the current thread to inject API hooks.
        /// </summary>
        /// <param name="selections">The implementations chosen for launch.</param>
        /// <param name="executor">The executor used to launch the new process.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param>
        /// <exception cref="ImplementationNotFoundException">The main implementation is not cached (possibly because it is installed natively).</exception>
        public RunHook(Selections selections, IExecutor executor, IFeedManager feedManager, ITaskHandler handler)
        {
            var feed = feedManager[selections.InterfaceUri];
            _target = new FeedTarget(selections.InterfaceUri, feed);

            var mainImplementation = selections.MainImplementation;
            _implementationDir = executor.GetImplementationPath(mainImplementation);
            _mainImplementation = feed[mainImplementation.ID];

            _handler = handler;
            _registryFilter = GetRegistryFilter();
            _relaunchControl = GetRelaunchControl();

            Log.Info("Activating API hooking");
            _hookW = LocalHook.Create(LocalHook.GetProcAddress("kernel32.dll", "CreateProcessW"), new UnsafeNativeMethods.DCreateProcessW(CreateProcessWCallback), null);
            _hookW.ThreadACL.SetInclusiveACL(new[] {Thread.CurrentThread.ManagedThreadId});
            _hookA = LocalHook.Create(LocalHook.GetProcAddress("kernel32.dll", "CreateProcessA"), new UnsafeNativeMethods.DCreateProcessA(CreateProcessACallback), null);
            _hookA.ThreadACL.SetInclusiveACL(new[] {Thread.CurrentThread.ManagedThreadId});
        }
コード例 #52
0
ファイル: Process.cs プロジェクト: enckse/rsscl
        /// <summary>
        /// Go and process the request, executing the output action
        /// </summary>
        /// <param name='options'>
        /// Options for processing
        /// </param>
        /// <param name="manager">
        /// The manager
        /// </param>
        /// <param name='outputAction'>
        /// Output action.
        /// </param>
        public static void Go(Option options, IFeedManager manager, Action<string> outputAction)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            if (outputAction == null)
            {
                throw new ArgumentNullException("outputAction");
            }

            Execute(options, manager, outputAction);
        }
コード例 #53
0
 public BlogController(
     IOrchardServices services, 
     IBlogService blogService,
     IBlogPostService blogPostService,
     IBlogPathConstraint blogPathConstraint,
     IFeedManager feedManager, 
     IShapeFactory shapeFactory,
     IWorkContextAccessor workContextAccessor,
     IEnumerable<IHomePageProvider> homePageProviders,
     ISiteService siteService) {
     _services = services;
     _blogService = blogService;
     _blogPostService = blogPostService;
     _blogPathConstraint = blogPathConstraint;
     _feedManager = feedManager;
     _workContextAccessor = workContextAccessor;
     _siteService = siteService;
     _routableHomePageProvider = homePageProviders.SingleOrDefault(p => p.GetProviderName() == RoutableHomePageProvider.Name);
     Logger = NullLogger.Instance;
     Shape = shapeFactory;
 }
コード例 #54
0
 public TimetableController(
     IOrchardServices services, 
     ITimetableService TimetableService,
     ITimetableAppointmentService TimetableAppointmentService,
     ITimetableSlugConstraint TimetableSlugConstraint,
     IFeedManager feedManager, 
     IShapeFactory shapeFactory,
     IWorkContextAccessor workContextAccessor,
     IEnumerable<IHomePageProvider> homePageProviders,
     ISiteService siteService) {
     _services = services;
     _TimetableService = TimetableService;
     _TimetableAppointmentService = TimetableAppointmentService;
     _TimetableSlugConstraint = TimetableSlugConstraint;
     _feedManager = feedManager;
     _workContextAccessor = workContextAccessor;
     _siteService = siteService;
     _routableHomePageProvider = homePageProviders.SingleOrDefault(p => p.GetProviderName() == RoutableHomePageProvider.Name);
     Logger = NullLogger.Instance;
     Shape = shapeFactory;
 }
コード例 #55
0
        /// <summary>
        /// Creates a new external JSON solver.
        /// </summary>
        /// <param name="backingSolver">An internal solver used to find an implementation of the external solver.</param>
        /// <param name="selectionsManager">Used to check whether the external solver is already in the cache.</param>
        /// <param name="fetcher">Used to download implementations of the external solver.</param>
        /// <param name="executor">Used to launch the external solver.</param>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param>
        public ExternalSolver([NotNull] ISolver backingSolver, [NotNull] ISelectionsManager selectionsManager, [NotNull] IFetcher fetcher, [NotNull] IExecutor executor, [NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] ITaskHandler handler)
        {
            #region Sanity checks
            if (backingSolver == null) throw new ArgumentNullException(nameof(backingSolver));
            if (selectionsManager == null) throw new ArgumentNullException(nameof(selectionsManager));
            if (fetcher == null) throw new ArgumentNullException(nameof(fetcher));
            if (executor == null) throw new ArgumentNullException(nameof(executor));
            if (config == null) throw new ArgumentNullException(nameof(config));
            if (feedManager == null) throw new ArgumentNullException(nameof(feedManager));
            if (handler == null) throw new ArgumentNullException(nameof(handler));
            #endregion

            _backingSolver = backingSolver;
            _selectionsManager = selectionsManager;
            _fetcher = fetcher;
            _executor = executor;
            _feedManager = feedManager;
            _handler = handler;

            _solverRequirements = new Requirements(config.ExternalSolverUri);
        }
コード例 #56
0
 /// <inheritdoc/>
 public void ShowSelections(Selections selections, IFeedManager feedManager)
 {
     // Stub to be overriden
 }
コード例 #57
0
 public FeedHub()
 {
     _feedManager = NinjectRegistry.GetKernel().Get<IFeedManager>();
     _authentication = NinjectRegistry.GetKernel().Get<IAuthentication>();
     _rssManager = NinjectRegistry.GetKernel().Get<IRssManager>();
 }
コード例 #58
0
ファイル: Process.cs プロジェクト: enckse/rsscl
        /// <summary>
        /// Process the request, executing the output action
        /// </summary>
        /// <param name='options'>
        /// Options for processing
        /// </param>
        /// <param name="manager">
        /// The manager
        /// </param>
        /// <param name='outputAction'>
        /// Output action.
        /// </param>
        private static void Execute(Option options, IFeedManager manager, Action<string> outputAction)
        {
            XmlWriter writer = null;
            var serializer = new JavaScriptSerializer();
            try
            {
                var buffer = new System.Text.StringBuilder();
                if (options.Format == Format.Xml)
                {
                    writer = XmlWriter.Create(buffer);
                }

                PrintHeader(options.Format, writer, buffer);
                bool firstFeed = true;
                foreach (var feed in manager.Get(options.InputFile))
                {
                    bool hasChild = true;
                    bool firstItem = true;
                    foreach (var item in manager.GetItems(feed, options.Since, options.IgnoreCerts))
                    {
                        if (hasChild)
                        {
                            if (options.Format == Format.Json)
                            {
                                if (!firstFeed)
                                {
                                    buffer.Append(",");
                                }

                                firstFeed = false;
                            }

                            PrintFeed(options.Format, feed, outputAction, writer, buffer, serializer);
                            hasChild = false;
                        }

                        if (options.Format == Format.Json)
                        {
                            if (!firstItem)
                            {
                                buffer.Append(",");
                            }

                            firstItem = false;
                        }

                        PrintItem(options.Format, item, outputAction, writer, buffer, serializer);
                        if (buffer.Length >= FlushBuffer)
                        {
                            outputAction(buffer.ToString());
                            buffer.Clear();
                        }
                    }

                    if (!hasChild)
                    {
                        PrintFeedEnd(options.Format, writer, buffer);
                    }
                }

                PrintEnd(options.Format, writer, buffer);
                if (options.Format != Format.Console)
                {
                    outputAction(buffer.ToString());
                }
            }
            finally
            {
                if (writer != null)
                {
                    ((IDisposable)writer).Dispose();
                }
            }
        }
コード例 #59
0
 public BlogHomePageProvider(IOrchardServices services, IBlogService blogService, IBlogSlugConstraint blogSlugConstraint, IFeedManager feedManager) {
     Services = services;
     _blogService = blogService;
     _blogSlugConstraint = blogSlugConstraint;
     _feedManager = feedManager;
 }
コード例 #60
0
ファイル: FeedFilter.cs プロジェクト: mofashi2011/orchardcms
 public FeedFilter(IFeedManager feedManager) {
     _feedManager = feedManager;
 }