/// <summary>Initializes a new instance of the <see cref="ExtractParameters"/> class.</summary> /// <param name="settings">The plug in settings.</param> /// <param name="data">The data structure that will hold the information used to extract sprites.</param> /// <param name="textureFile">The file used as the texture.</param> /// <param name="extractor">The extractor used to build the sprites.</param> /// <param name="colorPicker">The color picker service.</param> /// <param name="folderBrowser">The project file system folder browser service.</param> /// <param name="commonServices">The common services.</param> /// <exception cref="ArgumentNullException">Thrown when the any parameters are <b>null</b>.</exception> /// <exception cref="ArgumentMissingException">Thrown when the <see cref="SpriteExtractionData.Texture"/> property of the <paramref name="data"/> parameter is <b>null</b>.</exception> public ExtractParameters(ExtractSpriteToolSettings settings, SpriteExtractionData data, IContentFile textureFile, IExtractorService extractor, IColorPickerService colorPicker, IFileSystemFolderBrowseService folderBrowser, IViewModelInjection commonServices) : base(commonServices) { Settings = settings ?? throw new ArgumentNullException(nameof(settings)); Data = data ?? throw new ArgumentNullException(nameof(data)); Extractor = extractor ?? throw new ArgumentNullException(nameof(extractor)); ColorPicker = colorPicker ?? throw new ArgumentNullException(nameof(colorPicker)); FolderBrowser = folderBrowser ?? throw new ArgumentNullException(nameof(folderBrowser)); TextureFile = textureFile ?? throw new ArgumentNullException(nameof(textureFile)); if (data.Texture == null) { throw new ArgumentMissingException(nameof(data.Texture), nameof(data)); } }
/// <summary> /// Function to perform any required initialization for the plugin. /// </summary> /// <param name="pluginService">The plugin service used to access other plugins.</param> /// <param name="graphicsContext">The graphics context for the application.</param> /// <param name="folderBrowser">The file system folder browser.</param> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="pluginService"/>, <paramref name="graphicsContext"/>, or the <paramref name="folderBrowser"/> parameter is <b>null</b>.</exception> /// <remarks> /// <para> /// This method is only called when the plugin is loaded at startup. /// </para> /// </remarks> public void Initialize(IToolPlugInService pluginService, IGraphicsContext graphicsContext, IFileSystemFolderBrowseService folderBrowser) { if (Interlocked.Exchange(ref _initialized, 1) == 1) { return; } ToolPlugInService = pluginService ?? throw new ArgumentNullException(nameof(pluginService)); CommonServices.Log.Print($"Initializing {Name}...", LoggingLevel.Simple); GraphicsContext = graphicsContext ?? throw new ArgumentNullException(nameof(graphicsContext)); FolderBrowser = folderBrowser ?? throw new ArgumentNullException(nameof(folderBrowser)); OnInitialize(); }
/// <summary>Initializes a new instance of the <see cref="TextureAtlasParameters"/> class.</summary> /// <param name="settings">The settings for the plug in.</param> /// <param name="spriteFiles">The sprite file manager.</param> /// <param name="atlasGen">The atlas generation service.</param> /// <param name="fileService">The service used for file I/O operations.</param> /// <param name="folderBrowser">The folder browser.</param> /// <param name="commonServices">The common services for the application.</param> /// <exception cref="ArgumentNullException">Thrown when any of the parameters are <b>null</b>.</exception> public TextureAtlasParameters(TextureAtlasSettings settings, ISpriteFiles spriteFiles, IGorgonTextureAtlasService atlasGen, IFileIOService fileService, IFileSystemFolderBrowseService folderBrowser, IViewModelInjection commonServices) : base(commonServices) { Settings = settings ?? throw new ArgumentNullException(nameof(settings)); SpriteFiles = spriteFiles ?? throw new ArgumentNullException(nameof(spriteFiles)); AtlasGenerator = atlasGen ?? throw new ArgumentNullException(nameof(atlasGen)); FolderBrowser = folderBrowser ?? throw new ArgumentNullException(nameof(folderBrowser)); FileManager = fileService ?? throw new ArgumentNullException(nameof(fileService)); }