/// <summary>
 /// Instantiates a new instance of a <see cref="ComponentFactory"/> with the given id and <see cref="Addon.IAddonFactory"/>.
 /// </summary>
 /// <param name="id">The unique id representing this <see cref="ComponentFactory"/>.</param>
 /// <param name="addonFactory">The <see cref="Addon.IAddonFactory"/> needed to create and control this extension, or plugin.</param>
 /// <param name="packageConfiguration">The <see cref="Packaging.IPackageConfiguration"/> for the package this component was located in.</param>
 /// <param name="customConfiguration">The custom configuration, if found; otherwise, null.</param>
 /// <param name="installationRootPath">The root path where the <see cref="Installation.IInstaller"/> installs packages.</param>
 /// <param name="installPath">The install directory path where this component's package has been installed.</param>
 /// <param name="temporaryPath">A temporary folder for the <see cref="IComponent"/> to use.</param>
 /// <param name="longTermStoragePath">A permanent folder for the <see cref="IComponent"/> to use.</param>
 /// <param name="folderAccessItems">A collection of folders.</param>
 public ComponentFactory(string id,
                         Addon.IAddonFactory addonFactory,
                         Packaging.IPackageConfiguration packageConfiguration,
                         Configuration.IConfigurationGroup customConfiguration,
                         string installationRootPath,
                         string installPath,
                         string temporaryPath,
                         string longTermStoragePath,
                         IFolderAccessItems folderAccessItems) : this()
 {
     if (string.IsNullOrWhiteSpace(id))
     {
         throw new ArgumentNullException(nameof(id));
     }
     Id                   = id;
     _AddonFactory        = addonFactory ?? throw new ArgumentNullException(nameof(addonFactory));
     PackageConfiguration = packageConfiguration ?? throw new ArgumentNullException(nameof(packageConfiguration));
     CustomConfiguration  = customConfiguration;
     //
     if (string.IsNullOrWhiteSpace(installationRootPath))
     {
         throw new ArgumentNullException(nameof(installationRootPath));
     }
     _InstallationRootPath = installationRootPath;
     //
     if (string.IsNullOrWhiteSpace(installPath))
     {
         throw new ArgumentNullException(nameof(installPath));
     }
     _InstallPath = installPath;
     //
     if (string.IsNullOrWhiteSpace(temporaryPath))
     {
         throw new ArgumentNullException(nameof(temporaryPath));
     }
     _TemporaryPath = temporaryPath;
     //
     if (string.IsNullOrWhiteSpace(longTermStoragePath))
     {
         throw new ArgumentNullException(nameof(longTermStoragePath));
     }
     _LongTermStoragePath = longTermStoragePath;
     //
     _FolderAccessItems = folderAccessItems ?? throw new ArgumentNullException(nameof(folderAccessItems));
 }
예제 #2
0
 /// <summary>
 /// Prepares the component to be handled by the <see cref="ComponentController"/>.
 /// </summary>
 /// <param name="logMarshal">The <see cref="LogMarshal"/> provided by the <see cref="LogController"/>.</param>
 /// <param name="client">The <see cref="Networking.IClient"/> made for this component.</param>
 /// <param name="workingClient">A <see cref="Networking.IClient"/> made for temporary, unrestricted, communications. This client is not opened by default and should be closed when not being used.</param>
 /// <param name="logSourceId">The value used as the source id when creating log entries.</param>
 /// <param name="networkLogSourceId">The value used as the source id when creating network specific log entries.</param>
 /// <param name="packageConfiguration">The <see cref="Packaging.IPackageConfiguration"/> for the package this component was located in.</param>
 /// <param name="customConfiguration">The custom configuration, if found; otherwise, null.</param>
 /// <param name="installRootPath">The root path where the <see cref="Installation.IInstaller"/> installs packages.</param>
 /// <param name="installPath">The install directory path where this component's package has been installed.</param>
 /// <param name="temporaryPath">A temporary folder for the <see cref="IComponent"/> to use.</param>
 /// <param name="longTermStoragePath">A permanent folder for the <see cref="IComponent"/> to use.</param>
 /// <param name="folderAccessItems">A collection of folders.</param>
 public void Initialize(LogMarshal logMarshal,
                        Networking.IClient client,
                        Networking.IClient workingClient,
                        string logSourceId,
                        string networkLogSourceId,
                        Packaging.IPackageConfiguration packageConfiguration,
                        Configuration.IConfigurationGroup customConfiguration,
                        string installRootPath,
                        string installPath,
                        string temporaryPath,
                        string longTermStoragePath,
                        IFolderAccessItems folderAccessItems)
 {
     _LogMarshal   = logMarshal ?? throw new ArgumentNullException(nameof(logMarshal));
     Client        = client ?? throw new ArgumentNullException(nameof(client));
     WorkingClient = workingClient ?? throw new ArgumentNullException(nameof(workingClient));
     if (Client.ClientConfiguration.ReceivableTypesFilter.Count() > 0)
     {
         // add required message types to receivable message types filter
         var list = new List <Networking.IPayloadTypeInfo>(Client.ClientConfiguration.ReceivableTypesFilter);
         list.Add(new Networking.PayloadTypeInfo(typeof(SupportsComponentDesignationRequest)));
         Client.ClientConfiguration.ReplaceReceivableTypesFilter(list);
     }
     //
     if (string.IsNullOrWhiteSpace(logSourceId))
     {
         throw new ArgumentNullException(nameof(logSourceId));
     }
     LogSourceId = logSourceId;
     //
     if (string.IsNullOrWhiteSpace(networkLogSourceId))
     {
         throw new ArgumentNullException(nameof(networkLogSourceId));
     }
     _NetworkLogSourceId = networkLogSourceId;
     //
     PackageConfiguration = packageConfiguration ?? throw new ArgumentNullException(nameof(packageConfiguration));
     CustomConfiguration  = customConfiguration;
     //
     if (string.IsNullOrWhiteSpace(installRootPath))
     {
         throw new ArgumentNullException(nameof(installRootPath));
     }
     InstallRootPath = installRootPath;
     //
     if (string.IsNullOrWhiteSpace(installPath))
     {
         throw new ArgumentNullException(nameof(installPath));
     }
     InstallPath = installPath;
     //
     if (string.IsNullOrWhiteSpace(temporaryPath))
     {
         throw new ArgumentNullException(nameof(temporaryPath));
     }
     TemporaryPath = temporaryPath;
     //
     if (string.IsNullOrWhiteSpace(longTermStoragePath))
     {
         throw new ArgumentNullException(nameof(longTermStoragePath));
     }
     LongTermStoragePath = longTermStoragePath;
     //
     FolderAccessItems = folderAccessItems ?? throw new ArgumentNullException(nameof(folderAccessItems));
 }