Exemplo n.º 1
0
        public PluginActivator(
            [NotNull] ILicenceProvider licenseProvider,
            [NotNull] ILog log,
            [NotNull] IPluginContainerManager pluginContainerManager,
            [NotNull] IPluginRepository pluginRepository)
        {
            if (licenseProvider == null)
            {
                throw new ArgumentNullException(nameof(licenseProvider));
            }

            if (log == null)
            {
                throw new ArgumentNullException(nameof(log));
            }

            if (pluginContainerManager == null)
            {
                throw new ArgumentNullException(nameof(pluginContainerManager));
            }

            if (pluginRepository == null)
            {
                throw new ArgumentNullException(nameof(pluginRepository));
            }

            _licenseProvider        = licenseProvider;
            _log                    = log;
            _pluginContainerManager = pluginContainerManager;
            _pluginRepository       = pluginRepository;
        }
        public AppViewModel(IPluginRepository pluginRepository,
                            IAccountSettingsProvider accounts,
                            IApplicationSettingsProvider applicationSettings,
                            IColumnsSettingsProvider columnsSettings,
                            Func<IPluginLoader> createPluginLoader,
                            Func<ResourcesViewModel> createResourceViewModel)
        {
            _pluginRepository = pluginRepository;
            _accounts = accounts;
            _applicationSettings = applicationSettings;
            _columnsSettings = columnsSettings;

            _loader = createPluginLoader();

            Model = CompositionManager.Get<IMainViewModel>();

            Resources = createResourceViewModel();

            if (Model == null) return;
            Model.FilterGroups = new ObservableCollection<StreamModel>(_columnsSettings.Filters);

            if (Model.FilterGroups.Count != 0) return;
            var f = StreamModel.CreateDefault();
            Model.FilterGroups.Add(f);
        }
        public IAssemblyScanner Load(IPluginRepository repository, ILogMessagesFromRemoteAppDomains logger)
        {
            try
            {
                var builder = new ContainerBuilder();
                {
                    builder.RegisterModule(new SchedulingModule());

                    builder.Register(c => new PartImportEngine(
                                         c.Resolve <ISatisfyPluginRequests>()))
                    .As <IConnectParts>();

                    builder.RegisterInstance(repository)
                    .As <IPluginRepository>()
                    .As <ISatisfyPluginRequests>();
                }

                var container = builder.Build();

                Func <IBuildFixedSchedules> scheduleBuilder = () => container.Resolve <IBuildFixedSchedules>();
                return(new RemoteAssemblyScanner(
                           container.Resolve <IPluginRepository>(),
                           container.Resolve <IConnectParts>(),
                           logger,
                           scheduleBuilder));
            }
            catch (Exception e)
            {
                logger.Log(LevelToLog.Error, e.ToString());
                throw;
            }
        }
Exemplo n.º 4
0
 public RestController(
     IPluginRepository <IServerCommand> commandsRepository,
     RestApplication application)
 {
     this.CommandsRepository = commandsRepository;
     this.Application        = application;
 }
Exemplo n.º 5
0
        public UpdateProjectPluginSettingsCommandHandler(
            [NotNull] IUserAuthorityValidator userAuthorityValidator,
            [NotNull] IWriteRepository <Projects> repositoryProjects,
            [NotNull] ITimeService timeService,
            [NotNull] IUnitOfWork unitOfWork,
            [NotNull] IUserPrincipal userPrincipal,
            [NotNull] IProjectPluginSettingsProvider projectPluginSettingsProvider,
            [NotNull] IPluginRepository pluginRepository)
            : base(
                userAuthorityValidator,
                repositoryProjects,
                timeService,
                unitOfWork,
                userPrincipal)
        {
            if (projectPluginSettingsProvider == null)
            {
                throw new ArgumentNullException(nameof(projectPluginSettingsProvider));
            }
            if (pluginRepository == null)
            {
                throw new ArgumentNullException(nameof(pluginRepository));
            }

            _projectPluginSettingsProvider = projectPluginSettingsProvider;
            _pluginRepository = pluginRepository;
        }
        public IAssemblyScanner Load(IPluginRepository repository, ILogMessagesFromRemoteAppDomains logger)
        {
            try
            {
                var builder = new ContainerBuilder();
                {
                    builder.RegisterModule(new SchedulingModule());

                    builder.Register(c => new PartImportEngine(
                            c.Resolve<ISatisfyPluginRequests>()))
                        .As<IConnectParts>();

                    builder.RegisterInstance(repository)
                        .As<IPluginRepository>()
                        .As<ISatisfyPluginRequests>();
                }

                var container = builder.Build();

                Func<IBuildFixedSchedules> scheduleBuilder = () => container.Resolve<IBuildFixedSchedules>();
                return new RemoteAssemblyScanner(
                    container.Resolve<IPluginRepository>(),
                    container.Resolve<IConnectParts>(),
                    logger,
                    scheduleBuilder);
            }
            catch (Exception e)
            {
                logger.Log(LevelToLog.Error, e.ToString());
                throw;
            }
        }
Exemplo n.º 7
0
 public EditModel(IPluginRepository pluginRepository, PluginsController pluginsController, CategoriesController categoriesController)
 {
     _pluginRepository     = pluginRepository;
     _pluginsController    = pluginsController;
     _categoriesController = categoriesController;
     Categories            = new List <CategoryDetails>();
 }
Exemplo n.º 8
0
 public RestMiddleware(
     IPluginRepository <IServerCommand> commandsRepository,
     RestApplication application)
 {
     this.CommandsRepository = commandsRepository;
     this.Application        = application;
 }
Exemplo n.º 9
0
 public PluginLoader(ILog logger, IDirectoryLocator directoryLocator, IPluginRepository pluginRepository, IPluginService pluginService)
 {
     _logger           = logger;
     _directoryLocator = directoryLocator;
     _pluginRepository = pluginRepository;
     _pluginService    = pluginService;
 }
Exemplo n.º 10
0
        public void Initialize(string rootPath, ITheUserExperience userExperience = null)
        {
            var pluginPath = Path.Combine(rootPath, ConfigurationManager.AppSettings.Get("PlgDir"));
            var pluginRepositoryPath = Path.Combine(rootPath, ConfigurationManager.AppSettings.Get("PginRepoPath"));
            var pluginPickerPath = Path.Combine(rootPath, ConfigurationManager.AppSettings.Get("PluginPickerDirectory"));
            var theUserExperienceDirectory = Path.Combine(rootPath, ConfigurationManager.AppSettings.Get("UsrExpDir"));

            // Find The User Experience if available
            var theUserExperience = Utilities.GetTheUserExperience(theUserExperienceDirectory);

            // Find Repository factories available...
            var repositoryFactories = Utilities.GetPluginRepositoryFactories(pluginRepositoryPath);

            // ... if there are none, then use the fail safe, otherwise pick a random one to use
            if (repositoryFactories.Length == 0)
                repositoryFactories = new IPluginRepositoryFactory[] { new FailsafePluginRepositoryFactory() };

            if (repositoryFactories.Length == 1)
                PluginRepository = repositoryFactories[0].GetRepository();
            else
            {
                var selectedIndex = new Random().Next(pluginRepositoryPath.Length);
                PluginRepository = repositoryFactories[selectedIndex].GetRepository();
            }

            theUserExperience.Show();
        }
Exemplo n.º 11
0
 public PluginService(IKernel kernel, IDirectoryLocator directoryLocator, IPreferenceManager preferenceManager, IPluginRepository repository)
 {
     _kernel            = kernel;
     _directoryLocator  = directoryLocator;
     _preferenceManager = preferenceManager;
     _repository        = repository;
 }
Exemplo n.º 12
0
        public ProjectProvider(IConfiguration configuration, IPluginRepository pluginRepository)
        {
            _configuration = configuration;

            _projectFactory = new ProjectFactory(pluginRepository, configuration);
            _projectFactory.ErrorOccured += (sender, args) => ErrorOccured?.Invoke(this, args);
        }
Exemplo n.º 13
0
 public InitialSetupOverlayViewModel(SettingsViewModel settingsViewModel, IPluginRepository pluginRepository)
 {
     _settingsViewModel = settingsViewModel;
     ConnectionsAndProjectsSettingsViewModel = new ConnectionsAndProjectsSettingsViewModel(settingsViewModel.ConnectionsSubSet, settingsViewModel.ProjectsSubSet, pluginRepository);
     ConnectionsAndProjectsSettingsViewModel.Items.Add(new ButtonNavigationItem("Placeholder. Restart BuildNotifications with setup Project and Connection to get to the default view", "Test", IconType.Dummy));
     settingsViewModel.SettingsChanged += UpdateText;
     UpdateText();
 }
Exemplo n.º 14
0
        public PluginService(ILog logger, IKernel kernel, IDirectoryLocator directoryLocator, IPluginRepository repository)
        {
            Logger = logger;

            _kernel = kernel;
            _directoryLocator = directoryLocator;
            _repository = repository;
        }
Exemplo n.º 15
0
 public SmallSyncTask(IApplicationBuilder app)
 {
     _embyClient               = app.ApplicationServices.GetService <IEmbyClient>();
     _embyPluginRepository     = app.ApplicationServices.GetService <IPluginRepository>();
     _embyServerInfoRepository = app.ApplicationServices.GetService <IServerInfoRepository>();
     _configurationRepository  = app.ApplicationServices.GetService <IConfigurationRepository>();
     _embyDriveRepository      = app.ApplicationServices.GetService <IDriveRepository>();
 }
Exemplo n.º 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PluginRepositoryProxy"/> class.
        /// </summary>
        /// <param name="repository">The object that stores all the parts and part groups.</param>
        public PluginRepositoryProxy(IPluginRepository repository)
        {
            {
                Debug.Assert(repository != null, "The repository object should not be a null reference.");
            }

            m_Repository = repository;
        }
Exemplo n.º 17
0
        internal PluginSettings(Plugin plugin, IPluginRepository pluginRepository)
        {
            Plugin          = plugin;
            Plugin.Settings = this;

            _pluginRepository = pluginRepository;
            _settingEntities  = new Dictionary <string, object>();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PluginRepositoryProxy"/> class.
        /// </summary>
        /// <param name="repository">The object that stores all the parts and part groups.</param>
        public PluginRepositoryProxy(IPluginRepository repository)
        {
            {
                Debug.Assert(repository != null, "The repository object should not be a null reference.");
            }

            m_Repository = repository;
        }
Exemplo n.º 19
0
        public Server(IPEndPoint endPoint, IPluginRepository repository)
        {
            _repository = repository;

            _socket = new SocketServer($"{Constants.ApplicationTitle} Socket");
            _socket.RegisterSubject(Archiver.Repository.Constants.PluginRepositoryV1Id, _repository);
            _socket.Bind(endPoint);
        }
        public TwitterSearchClassic(
            IContactsRepository contactsRepository,
            IPluginRepository pluginRepository)
        {
            _contactsRepository = contactsRepository;
            _pluginRepository = pluginRepository;

            _searchTerms = new List<string>();
        }
        public ConnectionViewModel(ConnectionData model, IPluginRepository pluginRepository)
        {
            Model            = model;
            PluginRepository = pluginRepository;
            TestConnection   = new TestConnectionViewModel(PluginRepository);

            ConnectionPluginType = model.ConnectionType;
            SelectedPlugin       = SelectPluginFromModel();
        }
Exemplo n.º 22
0
 public PluginService(IPluginRepository pluginRepository, IGuildService guildService,
                      IUserService userService, ILogService logService, IBotService botService)
 {
     _pluginRepository = pluginRepository;
     _guildService     = guildService;
     _userService      = userService;
     _logService       = logService;
     _botService       = botService;
 }
Exemplo n.º 23
0
        public PluginManagementService(IKernel kernel, ILogger logger, IPluginRepository pluginRepository)
        {
            _kernel           = kernel;
            _logger           = logger;
            _pluginRepository = pluginRepository;
            _plugins          = new List <Plugin>();

            ProcessQueuedActions();
        }
Exemplo n.º 24
0
        public SoapApplication(
            IProcessingEngine processingEngine,
            IPluginRepository <IServerCommand> serverCommandsRepository)
        {
            Contract.Requires(processingEngine != null);
            Contract.Requires(serverCommandsRepository != null);

            this.ProcessingEngine = processingEngine;
            this.ServerCommands   = serverCommandsRepository;
        }
Exemplo n.º 25
0
        private void DownloadAndInstall(IPluginRepository repository, PluginIdentifier id)
        {
            var content  = repository.DownloadPlugin(id);
            var fileName = $"{id.Id}.{id.Version}.tvp";
            var filePath = Path.Combine(Constants.DownloadedPluginsPath, fileName);
            var folder   = Path.GetDirectoryName(filePath);

            Directory.CreateDirectory(folder);
            File.WriteAllBytes(filePath, content);
        }
Exemplo n.º 26
0
        public SoapApplication(
            IProcessingEngine processingEngine,
            IPluginRepository<IServerCommand> serverCommandsRepository)
        {
            Contract.Requires(processingEngine != null);
            Contract.Requires(serverCommandsRepository != null);

            this.ProcessingEngine = processingEngine;
            this.ServerCommands = serverCommandsRepository;
        }
Exemplo n.º 27
0
        public TestConnectionViewModel(IPluginRepository pluginRepository)
        {
            _pluginRepository = pluginRepository;

            StatusIndicator = new StatusIndicatorViewModel();
            Notifications   = new NotificationCenterViewModel {
                ShowEmptyMessage = false, ShowTimeStamp = false
            };
            TestConnectionCommand = AsyncCommand.Create(TestConnection);
        }
Exemplo n.º 28
0
 public RestApplication(
     IProcessingEngine processingEngine,
     IObjectFactory objectFactory,
     IWireSerialization serialization,
     IPluginRepository <IServerCommand> commandsRepository)
 {
     this.ProcessingEngine   = processingEngine;
     this.ObjectFactory      = objectFactory;
     this.Serialization      = serialization;
     this.CommandsRepository = commandsRepository;
 }
 public ExtrasViewModel(
     IPluginRepository pluginRepository,
     IEnumerable<IStatusHandler> statusHandlers,
     IEnumerable<IUrlShortener> urlShorteners,
     IEventAggregator eventAggregator)
     : base(eventAggregator)
 {
     StatusHandlers = new ObservableCollection<IStatusHandler>(statusHandlers.OrderBy(m => m.Name));
     UrlShorteners = new ObservableCollection<IUrlShortener>(urlShorteners.Where(u => u.HasSettings));
     ShowSettingsCommand = new DelegateCommand<IPlugin>(ShowSettings);
 }
Exemplo n.º 30
0
        public AboutBox(IPluginRepository pluginRepository)
        {
            InitializeComponent();

            SetWindowTitle();
            PopulateHeader();
            PopulateLicenses();
            PopulateSystemInfo(pluginRepository);

            creditPanel.EnableVerticalKeyboardScroll();
        }
Exemplo n.º 31
0
        private void PopulateSystemInfo(IPluginRepository pluginRepository)
        {
            var newline = Environment.NewLine;
            var plugins = string.Join(newline, pluginRepository.PluginsByType.Select(ToString));

            textBoxSystemInfo.Text = string.Format("{1} {0}{0}Plugins:{0}{2}{0}{0}{3}",
                                                   newline,
                                                   _nameAndVersion,
                                                   plugins,
                                                   SystemInfo.Instance);
        }
Exemplo n.º 32
0
 public EmbyService(IEmbyClient embyClient,
                    IPluginRepository embyPluginRepository,
                    IConfigurationRepository configurationRepository,
                    IServerInfoRepository embyServerInfoRepository,
                    IDriveRepository embyDriveRepository)
 {
     _embyClient               = embyClient;
     _embyPluginRepository     = embyPluginRepository;
     _configurationRepository  = configurationRepository;
     _embyServerInfoRepository = embyServerInfoRepository;
     _embyDriveRepository      = embyDriveRepository;
 }
Exemplo n.º 33
0
        public PluginManager
        (
            IPluginRepository pluginRepository,
            IInstalledPluginRepository installationRepository
        )
        {
            Validate.IsNotNull(pluginRepository);
            Validate.IsNotNull(installationRepository);

            _pluginRepository       = pluginRepository;
            _installationRepository = installationRepository;
        }
Exemplo n.º 34
0
 public PluginService(IPluginRepository repository, IValidationService validator, IPluginEngine pluginEngine, IModulesLoaded modules, PluginTemplateRegistry pluginTemplateRegistry, PluginStyleRegistry pluginStyleRegistry, PluginScriptRegistry pluginScriptRegistry, OxiteContext context)
 {
     this.repository             = repository;
     this.validator              = validator;
     this.pluginEngine           = pluginEngine;
     this.cache                  = modules.GetModules <IOxiteCacheModule>().Reverse().First();
     this.modules                = modules;
     this.pluginTemplateRegistry = pluginTemplateRegistry;
     this.pluginStyleRegistry    = pluginStyleRegistry;
     this.pluginScriptRegistry   = pluginScriptRegistry;
     this.context                = context;
 }
Exemplo n.º 35
0
 private bool TryDownloadAndInstall(IPluginRepository repository, PluginIdentifier id)
 {
     try
     {
         DownloadAndInstall(repository, id);
         return(true);
     }
     catch (Exception e)
     {
         Log.WarnFormat("Unable to download / install plugin '{0}':\r\n{1}", id, e);
         return(false);
     }
 }
Exemplo n.º 36
0
        public PluginService(IKernel kernel, ILogger logger, IPluginRepository pluginRepository)
        {
            _kernel           = kernel;
            _logger           = logger;
            _pluginRepository = pluginRepository;
            _plugins          = new List <PluginInfo>();

            // Ensure the plugins directory exists
            if (!Directory.Exists(Constants.DataFolder + "plugins"))
            {
                Directory.CreateDirectory(Constants.DataFolder + "plugins");
            }
        }
Exemplo n.º 37
0
        /*
         *  if (this.AdvertisedBeacon != null)
         *      throw new ArgumentException("You are already advertising a beacon");
         *
         *  var settings = new AdvertiseSettings.Builder()
         *      .SetAdvertiseMode(AdvertiseMode.Balanced)
         *      .SetConnectable(false);
         *
         *  var adData = new AdvertiseData.Builder()
         *      .AddManufacturerData(0x004C, beacon.ToIBeaconPacket(10)); // Apple
         *
         *  this.manager
         *      .Adapter
         *      .BluetoothLeAdvertiser
         *      .StartAdvertising(
         *          settings.Build(),
         *          adData.Build(),
         *          this.adCallbacks
         *      );
         *
         *  this.AdvertisedBeacon = beacon;
         */
        public BeaconManager(IAdapter adapter = null, IPluginRepository repository = null)
        {
            this.adapter    = adapter ?? CrossBleAdapter.Current;
            this.repository = repository ?? new SqlitePluginRepository();

            this.monitorSubject = new Subject <BeaconRegionStatusChanged>();
            this.regionStates   = new Dictionary <string, BeaconRegionStatus>();
            var regions = this.repository.GetTrackingRegions();

            foreach (var region in regions)
            {
                this.SetRegion(region);
            }
        }
Exemplo n.º 38
0
        public ErrorReport(Exception exception, IPluginRepository pluginRepository, IDirectoryLocator directoryLocator)
        {
            exception = GetBaseException(exception);

            ExceptionMessageRaw      = exception.Message;
            ExceptionMessageRedacted = Redact(ExceptionMessageRaw);

            ExceptionDetailRaw      = string.Format("{0}\n\nSource: {1}", exception, exception.Source);
            ExceptionDetailRedacted = Redact(ExceptionDetailRaw);

            var plugins = pluginRepository.PluginsByType.Select(ToString).ToList();

            AddPluginHeaderRows(plugins);

            var logMessages = BoundedMemoryAppender.RecentEvents.Select(ToString).ToArray();
            var logEvents   = string.Join("\n", logMessages);

            Title = string.Format("{0} v{1}: {2}: {3}", AppUtils.AppName, AppUtils.AppVersion, exception.GetType().FullName, ExceptionMessageRedacted);
            Body  = string.Format(@"
{0} v{1}{2} (built on {3:u})

Stack Trace
-----------

{4}

Log Events
----------

{5}

Plugins
-------

{6}

System Info
-----------

{7}
".TrimStart(),
                                  AppUtils.AppName,
                                  AppUtils.AppVersion,
                                  directoryLocator.IsPortable ? " portable" : "",
                                  AppUtils.BuildDate,
                                  FormatAsMarkdownCode(ExceptionDetailRedacted),
                                  FormatAsMarkdownCode(logEvents),
                                  FormatAsMarkdownTable(plugins.ToArray()),
                                  FormatAsMarkdownCode(SystemInfo.Instance.ToString()));
        }
        public UploadersViewModel(
            IPluginRepository pluginRepository,
            IEnumerable<IUploaderCreator> uploaders,
            IEventAggregator eventAggregator): base(eventAggregator)
        {
            PluginRepository = pluginRepository;
            NewUploaders = new ObservableCollection<IUploaderCreator>(uploaders.OrderBy(m => m.Name));

            AddCommand = new DelegateCommand<IUploaderCreator>(Add, a => CanAdd);
            RemoveCommand = new DelegateCommand<IUploader>(Remove, a => CanRemove);
            NewSelectedCommand = new DelegateCommand(NewSelected);
            ExistingSelectedCommand = new DelegateCommand(ExistingSelected);
            SaveSettingsCommand = new DelegateCommand(SaveSettings);
        }
        public StreamViewModel(
            IStatusUpdateService statusUpdateService,
            IPluginRepository pluginsRepository,
            StreamConfigurationViewModel streamConfigurationViewModel)
        {
            _pluginsRepository = pluginsRepository;
            _statusUpdate = statusUpdateService;

            StreamConfiguration = streamConfigurationViewModel;
            StreamConfiguration.Parent = this;

            Updates = new BindableList<IStatusUpdate>(_statusUpdate.OutgoingUpdates);
            _settings = CompositionManager.Get<IApplicationSettingsProvider>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AppDomainOwningPluginScanner"/> class.
        /// </summary>
        /// <param name="appDomainBuilder">The function that is used to create a new <c>AppDomain</c> which will be used to scan plugins.</param>
        /// <param name="repository">The object that contains the information about all the known parts and part groups.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the system.</param>
        public AppDomainOwningPluginScanner(
            Func<string, AppDomainPaths, AppDomain> appDomainBuilder,
            IPluginRepository repository,
            SystemDiagnostics diagnostics)
        {
            {
                Debug.Assert(appDomainBuilder != null, "The AppDomain building function should not be a null reference.");
                Debug.Assert(repository != null, "The repository object should not be a null reference.");
                Debug.Assert(diagnostics != null, "The diagnostics object should not be a null reference.");
            }

            m_AppDomainBuilder = appDomainBuilder;
            m_Repository = repository;
            m_Diagnostics = diagnostics;
        }
        public PluginBase PickPlugin(IPluginRepository repository)
        {
            // Determine pool of available plugins
            int pool = repository.Plugins.Length;

            // If there are no items in the pool, then use a failsafe
            if (pool == 0)
            {
                var pluginFactory = new FailsafePluginFactory();
                return pluginFactory.GetPlugin();
            }

            // Otherwise, pick a plugin at random
            var selectedItem = new Random().Next(pool);
            return repository.Plugins[selectedItem];
        }
        public AccountsViewModel(
            IPluginRepository pluginRepository,
            IEnumerable<IMicroblogSource> microblogs,
            IEventAggregator eventAggregator)
            : base(eventAggregator)
        {
            PluginRepository = pluginRepository;
            NewMicroblogs = new ObservableCollection<IMicroblogSource>(microblogs.OrderBy(f => f.Name));

            AddCommand = new DelegateCommand<ICreator>(Add); //, a => CanAdd);
            RemoveCommand = new DelegateCommand<IPlugin>(Remove); //, a => CanRemove);
            //NewSelectedCommand = new DelegateCommand(NewSelected);
            //ExistingSelectedCommand = new DelegateCommand(ExistingSelected);
            //SaveSettingsCommand = new DelegateCommand(SaveSettings);
            ShowSettingsCommand = new DelegateCommand<IPlugin>(ShowSettings);
        }
Exemplo n.º 44
0
        /// <summary>
        /// Returns a function that creates <see cref="TypeIdentity"/> objects and stores the type reference in a <see cref="IPluginRepository"/>.
        /// </summary>
        /// <param name="typeStorage">The object that stores the type definitions.</param>
        /// <param name="currentlyBuilding">
        /// The dictionary that keeps track of the types that are currently being constructed. This is necessary because of self-referencing generics,
        /// e.g. System.Boolean : IComparable{System.Boolean} etc.
        /// </param>
        /// <returns>The function that creates type identity objects.</returns>
        public static Func<Type, TypeIdentity> IdentityFactory(IPluginRepository typeStorage, IDictionary<Type, TypeIdentity> currentlyBuilding)
        {
            // Fake out the compiler because we need the function inside the function itself
            Func<Type, TypeIdentity> createTypeIdentity = null;
            createTypeIdentity =
                t =>
                {
                    // First make sure we're not already creating a definition for this type. If so then we just
                    // return the identity because at some point we'll get the definition being added.
                    // This is necessary because if we don't check this there is a good possibility that
                    // we end-up in an infinite loop. e.g. trying to handle
                    // System.Boolean means we have to process System.IComparable<System.Boolean> which means ....
                    if (currentlyBuilding.ContainsKey(t))
                    {
                        return currentlyBuilding[t];
                    }

                    // Create the type full name ourselves because generic type parameters don't have one (see
                    // http://blogs.msdn.com/b/haibo_luo/archive/2006/02/17/534480.aspx).
                    var name =
                        t.AssemblyQualifiedName
                        ?? string.Format(CultureInfo.InvariantCulture, "{0}.{1}, {2}", t.Namespace, t.Name, t.Assembly.FullName);
                    if (!typeStorage.ContainsDefinitionForType(name))
                    {
                        try
                        {
                            // Create a local version of the TypeIdentity and store that so that we can use that if we
                            // come across this type before we're completely finished storing the definition of it
                            var typeIdentity = TypeIdentity.CreateDefinition(t);
                            currentlyBuilding.Add(t, typeIdentity);

                            var typeDefinition = TypeDefinition.CreateDefinition(t, createTypeIdentity);
                            typeStorage.AddType(typeDefinition);
                        }
                        finally
                        {
                            // Once we add the real definition then we can just remove the local copy
                            // from the stack.
                            currentlyBuilding.Remove(t);
                        }
                    }

                    return typeStorage.IdentityByName(name);
                };

            return createTypeIdentity;
        }
        private void TweetViewLoaded(object sender, RoutedEventArgs e)
        {
            suvContainer.CompositionBox.SendMessage = new SendMessageCommand(ItemViewSendMessage);
            suvContainer.SendMessage = new SendMessageCommand(ItemViewSendMessage);

            _pluginRepository = CompositionManager.Get<IPluginRepository>();
            IEnumerable<Twitter> twitterAccounts = _pluginRepository.Microblogs.OfType<Twitter>();

            cbAccounts.ItemsSource = twitterAccounts;
            if (Tweet != null)
                cbAccounts.SelectedItem = Tweet.Types.Any()
                                              ? Tweet.Types.OrderByDescending(u => u.Order).First().Parent
                                              : twitterAccounts.First();

            if (cbAccounts.SelectedItem == null)
                cbAccounts.SelectedItem = twitterAccounts.First();
        }
Exemplo n.º 46
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PluginDetector"/> class.
        /// </summary>
        /// <param name="repository">The object that stores information about all the parts and the part groups.</param>
        /// <param name="scannerBuilder">The function that is used to create an assembly scanner.</param>
        /// <param name="fileSystem">The abstraction layer for the file system.</param>
        /// <param name="systemDiagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="repository"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="scannerBuilder"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="fileSystem"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />.
        /// </exception>
        public PluginDetector(
            IPluginRepository repository,
            Func<IPluginRepository, IAssemblyScanner> scannerBuilder,
            IFileSystem fileSystem,
            SystemDiagnostics systemDiagnostics)
        {
            {
                Lokad.Enforce.Argument(() => repository);
                Lokad.Enforce.Argument(() => scannerBuilder);
                Lokad.Enforce.Argument(() => fileSystem);
                Lokad.Enforce.Argument(() => systemDiagnostics);
            }

            m_Repository = repository;
            m_ScannerBuilder = scannerBuilder;
            m_FileSystem = fileSystem;
            m_Diagnostics = systemDiagnostics;
        }
        public MainViewModel(
            IPluginRepository pluginRepository,
            IAccountSettingsProvider accountSettings,
            IColumnsSettingsProvider columnsSettings,
            IApplicationSettingsProvider applicationSettingsProvider,
            Func<StreamViewModel> createStreamViewModel,
            Func<SearchViewModel> createSearchViewModel,
            SetupViewModel setupViewModel)
        {
            _pluginRepository = pluginRepository;
            _accountSettings = accountSettings;
            _columnsSettings = columnsSettings;
            _createStreamViewModel = createStreamViewModel;
            _createSearchViewModel = createSearchViewModel;
            _setupViewModel = setupViewModel;
            _applicationSettingsProvider = applicationSettingsProvider;

            EventAggregator.GetEvent<ShowLink>().Subscribe(HandleShowLink);
            EventAggregator.GetEvent<ShowProfile>().Subscribe(HandleShowProfile);
            EventAggregator.GetEvent<ShowConversation>().Subscribe(HandleShowConversation);
            EventAggregator.GetEvent<ShowSearch>().Subscribe(CreateNewSearch);
            EventAggregator.GetEvent<ShowContainer>().Subscribe(HandleShowContainer);
            EventAggregator.GetEvent<MicroblogAdded>().Subscribe(HandleNewMicroblog);
            EventAggregator.GetEvent<ShowColumns>().Subscribe(HandleNewColumns);

            ContactService = CompositionManager.Get<IContactService>();
            StatusManager = CompositionManager.Get<IStatusUpdateService>();

            SelectedMicroblogs = new ThreadSafeObservableCollection<IMicroblog>();

            CurrentSearches = new ObservableCollection<ISearchViewModel>();
            StreamContainers = new ObservableCollection<IContainerViewModel>();
            FilterGroups = new ObservableCollection<StreamModel>();

            HiddenPanels = new ObservableCollection<UIElement>();

            IsSearchVisible = false;
        }
Exemplo n.º 48
0
 public WcfService(IAssemblyRepository assemblyRepository, IPluginRepository pluginRepository, ILogger log)
 {
     this.assemblyRepository = assemblyRepository;
       this.pluginRepository = pluginRepository;
       this.log = log;
 }
Exemplo n.º 49
0
 public Client(ILogger log, IPluginRepository pluginRepository, IAssemblyRepository assemblyRepository)
 {
     this.log = log;
       this.pluginRepository = pluginRepository;
       this.assemblyRepository = assemblyRepository;
 }
Exemplo n.º 50
0
 public Controller(IPluginRepository pluginRepository)
 {
     _pluginRepository = pluginRepository;
 }
Exemplo n.º 51
0
 public Controller(IPluginRepository pluginRepository, IPreferenceManager preferenceManager)
 {
     _pluginRepository = pluginRepository;
     _preferenceManager = preferenceManager;
 }
Exemplo n.º 52
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoteAssemblyScanner"/> class.
        /// </summary>
        /// <param name="repository">The object that stores all the information about the parts and the part groups.</param>
        /// <param name="importEngine">The object that provides methods for part import matching.</param>
        /// <param name="logger">The object that passes through the log messages.</param>
        /// <param name="scheduleBuilder">The function that returns a schedule building object.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="repository"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="importEngine"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="logger"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="scheduleBuilder"/> is <see langword="null" />.
        /// </exception>
        public RemoteAssemblyScanner(
            IPluginRepository repository,
            IConnectParts importEngine,
            ILogMessagesFromRemoteAppDomains logger,
            Func<IBuildFixedSchedules> scheduleBuilder)
        {
            {
                Lokad.Enforce.Argument(() => repository);
                Lokad.Enforce.Argument(() => importEngine);
                Lokad.Enforce.Argument(() => logger);
                Lokad.Enforce.Argument(() => scheduleBuilder);
            }

            m_Repository = repository;
            m_ImportEngine = importEngine;
            m_Logger = logger;
            m_ScheduleBuilder = scheduleBuilder;
        }
Exemplo n.º 53
0
        public FormMain(ILog logger, IDirectoryLocator directoryLocator, IPreferenceManager preferenceManager,
                        PluginLoader pluginLoader, IPluginRepository pluginRepository, IController controller,
                        IDriveDetector driveDetector, ITaskbarItemFactory taskbarItemFactory,
                        INetworkStatusMonitor networkStatusMonitor, Updater updater)
        {
            InitializeComponent();

            Load += OnLoad;

            _logger = logger;
            _directoryLocator = directoryLocator;
            _preferenceManager = preferenceManager;
            _pluginLoader = pluginLoader;
            _pluginRepository = pluginRepository;
            _controller = controller;
            _driveDetector = driveDetector;
            _taskbarItem = taskbarItemFactory.GetInstance(Handle);
            _networkStatusMonitor = networkStatusMonitor;

            _updater = updater;
            _updater.IsPortable = _directoryLocator.IsPortable;
            _updateHelper = new UpdateHelper(_updater, AppUtils.AppVersion) { AllowDownload = false };

            _progressBarToolTip = new ToolTip();
            _progressBarToolTip.SetToolTip(progressBar, null);

            progressBar.UseCustomColors = true;
            progressBar.GenerateText = percentComplete => string.Format("{0}: {1:0.00}%", _state, percentComplete);

            playlistListView.ItemSelectionChanged += PlaylistListViewOnItemSelectionChanged;
            playlistListView.ShowAllChanged += PlaylistListViewOnShowAllChanged;
            playlistListView.PlaylistReconfigured += PlaylistListViewOnPlaylistReconfigured;

            tracksPanel.PlaylistReconfigured += TracksPanelOnPlaylistReconfigured;

            mediaPanel.SelectedMediaChanged += MediaPanelOnSelectedMediaChanged;
            mediaPanel.Search = ShowMetadataSearchWindow;

            var updateObserver = new FormMainUpdateObserver(this,
                                                            checkForUpdatesToolStripMenuItem,
                                                            updateToolStripMenuItem,
                                                            downloadUpdateToolStripMenuItem);
            updateObserver.BeforeInstallUpdate += update => DisableUpdates();
            SystemEvents.SessionEnded += (sender, args) => DisableUpdates();
            _updateHelper.RegisterObserver(updateObserver);

            FormClosing += OnFormClosing;

            var recentFiles = _preferenceManager.Preferences.RecentFiles;
            if (recentFiles.RememberRecentFiles && recentFiles.RecentBDROMPaths.Any())
            {
                textBoxInput.Text = recentFiles.RecentBDROMPaths.First();
            }

            InitSystemMenu();
        }
 public ChoosePluginViewModel(IPluginRepository pluginRepository)
 {
     Plugins = pluginRepository.Plugins;
 }
        public MainWindow(AppViewModel viewModel,
                          IPluginRepository pluginRepository,
                          IAccountSettingsProvider accountSettingsProvider,
                          IColumnsSettingsProvider columnsSettingsProvider,
                          IApplicationSettingsProvider applicationSettingsProvider,
                          IEventAggregator eventAggregator)
        {
            InitializeComponent();

            _pluginRepository = pluginRepository;
            _accountSettings = accountSettingsProvider;
            _columnsSettings = columnsSettingsProvider;
            _applicationSettingsProvider = applicationSettingsProvider;
            _eventAggregator = eventAggregator;

            var mainViewModel = viewModel.Model;
            var resourceViewModel = viewModel.Resources;

            txtUpdate.SetHeight((Double) FindResource("DefaultCompositionBoxHeight"));
            var c = (CompositionTextBox) txtUpdate.FindName("txtUpdateBox");
            if (c != null)
                c.IsInlineReply = false;

            Model = mainViewModel;
            ResourcesViewModel = resourceViewModel;
            mainViewModel.View = this;

            DataContext = mainViewModel;

            GlobalWindows.MainWindow = this;

            try
            {
                if (TaskbarManager.IsPlatformSupported)
                    TaskbarManager = TaskbarManager.Instance;
            }
            catch (Exception ex)
            {
                CompositionManager.Get<IExceptionReporter>().ReportHandledException(ex);
            }


            if (resourceViewModel.Views == null) return;

            //Import the XAML
            foreach (var r in resourceViewModel.Views)
            {
                Resources.MergedDictionaries.Add(r);
            }

            var ibShowSetup = new InputBinding(ShowSetup, new KeyGesture(Key.S, ModifierKeys.Control));
            var ibShowScriptingConsole = new InputBinding(ShowScriptConsoleCommand,
                                                          new KeyGesture(Key.S, ModifierKeys.Alt));
            InputBindings.Add(ibShowSetup);
            InputBindings.Add(ibShowScriptingConsole);

            var cbShowSetup = new CommandBinding(ShowSetup);
            cbShowSetup.Executed += CbShowSetupExecuted;
            CommandBindings.Add(cbShowSetup);

            var scriptConsole = new CommandBinding(ShowScriptConsoleCommand);
            scriptConsole.Executed += ScriptConsoleVisible;
            CommandBindings.Add(scriptConsole);

            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                MahTweets.Configuration.WindowSettings.SetSave(this, true);
            }
        }
Exemplo n.º 56
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupDefinitionBuilder"/> class.
        /// </summary>
        /// <param name="repository">The object that stores information about all the known parts and part groups.</param>
        /// <param name="importEngine">The object that matches part imports with part exports.</param>
        /// <param name="identityGenerator">The function that generates type identity objects.</param>
        /// <param name="builderGenerator">The function that is used to create schedule builders.</param>
        /// <param name="fileInfo">The file info for the assembly that owns the group exporter.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="repository"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="importEngine"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="identityGenerator"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="builderGenerator"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="fileInfo"/> is <see langword="null" />.
        /// </exception>
        public GroupDefinitionBuilder(
            IPluginRepository repository,
            IConnectParts importEngine,
            Func<Type, TypeIdentity> identityGenerator,
            Func<IBuildFixedSchedules> builderGenerator,
            PluginFileInfo fileInfo)
        {
            {
                Lokad.Enforce.Argument(() => repository);
                Lokad.Enforce.Argument(() => importEngine);
                Lokad.Enforce.Argument(() => identityGenerator);
                Lokad.Enforce.Argument(() => builderGenerator);
                Lokad.Enforce.Argument(() => fileInfo);
            }

            m_BuilderGenerator = builderGenerator;
            m_ImportEngine = importEngine;
            m_IdentityGenerator = identityGenerator;
            m_Repository = repository;
            m_FileInfo = fileInfo;
        }
Exemplo n.º 57
0
 public DevPluginService(ILog logger, IKernel kernel, IDirectoryLocator directoryLocator, IPluginRepository repository)
     : base(logger, kernel, directoryLocator, repository)
 {
 }