/// <summary>Initializes a new instance of the <see cref="ImportPlugInSettingsParameters"/> class.</summary> /// <param name="settings">The plug in settings.</param> /// <param name="codecs">The codec registry.</param> /// <param name="openCodecDialog">The service used to locate plug in assemblies for loading.</param> /// <param name="pluginService">The content plug in service.</param> /// <param name="commonServices">Common application services.</param> /// <exception cref="ArgumentNullException">Thrown when any parameter is <strong>null</strong>.</exception> public ImportPlugInSettingsParameters(SpriteImportSettings settings, ICodecRegistry codecs, IFileDialogService openCodecDialog, IContentPlugInService pluginService, IViewModelInjection commonServices) : base(commonServices) { Settings = settings ?? throw new ArgumentNullException(nameof(settings)); Codecs = codecs ?? throw new ArgumentNullException(nameof(settings)); OpenCodecDialog = openCodecDialog ?? throw new ArgumentNullException(nameof(openCodecDialog)); ContentPlugInService = pluginService ?? throw new ArgumentNullException(nameof(pluginService)); }
/// <summary>Initializes a new instance of the ImageContentVmParameters class.</summary> /// <param name="settings">The settings for the image editor.</param> /// <param name="codecs">The codecs loaded into the system.</param> /// <param name="codecDialog">The file dialog used to locate codec assemblies.</param> /// <param name="pluginService">The service used to manage content and importer plug ins.</param> /// <param name="plugInCache">The cache for plug in assemblies.</param> /// <param name="commonServices">Common application services.</param> /// <exception cref="ArgumentNullException">Thrown when any of the parameters are <b>null</b>.</exception> public SettingsParameters(ImageEditorSettings settings, ICodecRegistry codecs, IFileDialogService codecDialog, IContentPlugInService pluginService, GorgonMefPlugInCache plugInCache, IViewModelInjection commonServices) : base(commonServices) { Settings = settings ?? throw new ArgumentNullException(nameof(settings)); Codecs = codecs ?? throw new ArgumentNullException(nameof(codecs)); CodecFileDialog = codecDialog ?? throw new ArgumentNullException(nameof(codecDialog)); PlugInService = pluginService ?? throw new ArgumentNullException(nameof(pluginService)); PlugInCache = plugInCache ?? throw new ArgumentNullException(nameof(plugInCache)); }
/// <summary>Initializes a new instance of the <see cref="T:Gorgon.Editor.ImageEditor.ImageIO"/> class.</summary> /// <param name="defaultCodec">The default codec used by the plug in.</param> /// <param name="installedCodecs">The list of installed codecs.</param> /// <param name="importDialog">The dialog service used to export an image.</param> /// <param name="busyService">The busy state service.</param> /// <param name="scratchArea">The file system writer used to write to the temporary area.</param> /// <param name="bcCompressor">The block compressor used to block (de)compress image data.</param> /// <param name="log">The logging interface to use.</param> public ImageIOService(IGorgonImageCodec defaultCodec, ICodecRegistry installedCodecs, IExportImageDialogService exportDialog, IImportImageDialogService importDialog, IBusyStateService busyService, IGorgonFileSystemWriter <Stream> scratchArea, TexConvCompressor bcCompressor, IGorgonLog log) { _exportDialog = exportDialog; _importDialog = importDialog; DefaultCodec = defaultCodec; InstalledCodecs = installedCodecs; ScratchArea = scratchArea; _compressor = bcCompressor; _busyState = busyService; _log = log ?? GorgonLog.NullLog; }
/// <summary>Function to inject dependencies for the view model.</summary> /// <param name="injectionParameters">The parameters to inject.</param> /// <remarks> /// Applications should call this when setting up the view model for complex operations and/or dependency injection. The constructor should only be used for simple set up and initialization of objects. /// </remarks> protected override void OnInitialize(ImportPlugInSettingsParameters injectionParameters) { _messageDisplay = injectionParameters.MessageDisplay ?? throw new ArgumentMissingException(nameof(injectionParameters.MessageDisplay), nameof(injectionParameters)); _settings = injectionParameters.Settings ?? throw new ArgumentMissingException(nameof(injectionParameters.Settings), nameof(injectionParameters)); _plugInService = injectionParameters.ContentPlugInService ?? throw new ArgumentMissingException(nameof(injectionParameters.ContentPlugInService), nameof(injectionParameters)); _codecs = injectionParameters.Codecs ?? throw new ArgumentMissingException(nameof(injectionParameters.Codecs), nameof(injectionParameters)); _openCodecDialog = injectionParameters.OpenCodecDialog ?? throw new ArgumentMissingException(nameof(injectionParameters.OpenCodecDialog), nameof(injectionParameters)); _busyService = injectionParameters.BusyService ?? throw new ArgumentMissingException(nameof(injectionParameters.BusyService), nameof(injectionParameters)); foreach (GorgonSpriteCodecPlugIn plugin in _codecs.CodecPlugIns) { foreach (GorgonSpriteCodecDescription desc in plugin.Codecs) { IGorgonSpriteCodec codec = _codecs.Codecs.FirstOrDefault(item => string.Equals(item.GetType().FullName, desc.Name, StringComparison.OrdinalIgnoreCase)); if (codec == null) { continue; } CodecPlugInPaths.Add(new CodecSetting(codec.CodecDescription, plugin, desc)); } } }
/// <summary>Initializes a new instance of the <see cref="T:Gorgon.Editor.ImageEditor.ImportImageDialogService"/> class.</summary> /// <param name="settings">The settings.</param> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="settings" />, or the <paramref name="codecs"/> parameter is <strong>null</strong>.</exception> public ImportImageDialogService(ISettings settings, ICodecRegistry codecs) { _settings = settings ?? throw new ArgumentNullException(nameof(settings)); _codecs = codecs ?? throw new ArgumentNullException(nameof(codecs)); }