using CommandLine; using CommandLine.Text; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Web; namespace Tango.PPC.Common.Publish { public class PublishOptions : ExtendedObject { public event EventHandler EnvironmentChanged; public event EventHandler BuidConfigChanged; public event EventHandler BasicInfoChanged; public event EventHandler MachineVersionGuidChanged; public event EventHandler TfpPathChanged; public event EventHandler TagChanged; private String basePath; [Option("path", HelpText = "Specifies the application base path.", Required = false)] public String BasePath { get { return basePath; } set { basePath = value; RaisePropertyChangedAuto(); } } private String _buildConfig; [Option("build", HelpText = "Specifies the build configuration.", Required = false, DefaultValue = "Release")] public String BuildConfig { get { return _buildConfig; } set { _buildConfig = value; RaisePropertyChangedAuto(); BuidConfigChanged?.Invoke(this, new EventArgs()); } } private String _email; [Option("email", HelpText = "Email account used for login to the machine service.", Required = true)] public String Email { get { return _email; } set { _email = value; RaisePropertyChangedAuto(); BasicInfoChanged?.Invoke(this, new EventArgs()); } } private String _password; [Option("pass", HelpText = "Password used for login to the machine service.", Required = true)] public String Password { get { return _password; } set { _password = value; RaisePropertyChangedAuto(); BasicInfoChanged?.Invoke(this, new EventArgs()); } } private String _comments; [Option("comments", HelpText = "Optional comments that are attached to this release.", Required = false, DefaultValue = "No comments.")] public String Comments { get { return _comments; } set { _comments = value; RaisePropertyChangedAuto(); BasicInfoChanged?.Invoke(this, new EventArgs()); } } private String _tag; public String Tag { get { return _tag.IsNotNullOrEmpty() ? _tag : null; } set { _tag = value; RaisePropertyChangedAuto(); TagChanged?.Invoke(this, new EventArgs()); } } private DeploymentSlot _environment; [Option("env", HelpText = "Specifies the target environment to publish.", Required = true)] public DeploymentSlot Environment { get { return _environment; } set { _environment = value; RaisePropertyChangedAuto(); EnvironmentChanged?.Invoke(this, new EventArgs()); } } private String _machineVersionGuid; [Option("machine-version-guid", HelpText = "Specifies the machine version id for which to upload the PPC version.", Required = true)] public String MachineVersionGuid { get { return _machineVersionGuid; } set { _machineVersionGuid = value; RaisePropertyChangedAuto(); MachineVersionGuidChanged?.Invoke(this, new EventArgs()); } } private String _tfpPath; [Option("tfp", HelpText = "Specifies Tango Firmware Package file path (.tfp).", Required = true)] public String TfpPath { get { return _tfpPath; } set { _tfpPath = value; RaisePropertyChangedAuto(); TfpPathChanged?.Invoke(this, new EventArgs()); } } private String _installerProject; [Option("installer-project-file", HelpText = "Specifies the advanced installer project file to build and upload.", Required = false)] public String InstallerProject { get { return _installerProject; } set { _installerProject = value; RaisePropertyChangedAuto(); } } private String _installerOutputFolder; [Option("installer-output-folder", HelpText = "Specifies where to save the installer application.", Required = false)] public String InstallerOutputFolder { get { return _installerOutputFolder; } set { _installerOutputFolder = value; RaisePropertyChangedAuto(); } } private SynchronizationOptions _synchronization; public SynchronizationOptions Synchronization { get { return _synchronization; } set { _synchronization = value; RaisePropertyChangedAuto(); } } private String _personalAccessToken; public String PersonalAccessToken { get { return _personalAccessToken; } set { _personalAccessToken = value; RaisePropertyChangedAuto(); } } private bool _createTag; public bool CreateTag { get { return _createTag; } set { _createTag = value; RaisePropertyChangedAuto(); } } private bool _autoCommitAndSync; public bool AutoCommitAndPush { get { return _autoCommitAndSync; } set { _autoCommitAndSync = value; RaisePropertyChangedAuto(); } } public PublishOptions() { BasePath = AppDomain.CurrentDomain.BaseDirectory + "..\\"; BuildConfig = "Release"; Synchronization = new SynchronizationOptions(); } public String GetApplicationPath() { return Path.Combine(BasePath, BuildConfig); } } }