// // ProjectTaskActionConvert.cs - represents a ProjectTaskAction that converts an ObjectModel from an input DataFormat to an output DataFormat. // // Author: // Michael Becker // // Copyright (c) 2020 Mike Becker's Software // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; using UniversalEditor.ObjectModels.Markup; using UniversalEditor.ObjectModels.Project; namespace UniversalEditor.ProjectTaskActions { /// /// Represents a that converts an from an input to an /// output . /// public class ProjectTaskActionConvert : ProjectTaskAction { /// /// The that specifies a /// compatible with the of the specified /// . /// public DataFormatReference InputDataFormatReference { get; set; } = null; /// /// The that specifies a /// compatible with the of the specified /// . /// public DataFormatReference OutputDataFormatReference { get; set; } = null; /// /// The to be converted upon project build. /// public ProjectFile ProjectFile { get; set; } = null; private static ProjectTaskActionReference _ptar = null; protected override ProjectTaskActionReference MakeReferenceInternal() { if (_ptar == null) { _ptar = base.MakeReferenceInternal(); _ptar.ProjectTaskActionTypeID = new Guid("{0EB3C0A9-804A-433F-BDD8-888D0CA8C760}"); _ptar.ProjectTaskActionTypeName = "UniversalEditor.ProjectTaskActionConvert"; } return _ptar; } public override string Title { get { return "Convert: "; } } protected override void ExecuteInternal(ExpandedStringVariableStore variables) { } protected override void LoadFromMarkupInternal(MarkupTagElement tag) { MarkupTagElement tagInputDataFormatReference = (tag.Elements["InputDataFormatReference"] as MarkupTagElement); if (tagInputDataFormatReference != null) { MarkupAttribute attTypeName = tagInputDataFormatReference.Attributes["TypeName"]; MarkupAttribute attTypeID = tagInputDataFormatReference.Attributes["TypeID"]; if (attTypeName == null && attTypeID == null) throw new ArgumentNullException("Must specify at least one of 'TypeName' or 'TypeID'"); } MarkupTagElement tagOutputDataFormatReference = (tag.Elements["OutputDataFormatReference"] as MarkupTagElement); if (tagOutputDataFormatReference != null) { MarkupAttribute attTypeName = tagOutputDataFormatReference.Attributes["TypeName"]; MarkupAttribute attTypeID = tagOutputDataFormatReference.Attributes["TypeID"]; if (attTypeName == null && attTypeID == null) throw new ArgumentNullException("Must specify at least one of 'TypeName' or 'TypeID'"); } } } }