protected override void Execute(NativeActivityContext context) { var pModel = new PackageModel(); pModel.Id = PackageId.Get(context); pModel.Description = Description.Get(context); pModel.Version = Models.PackageModel.CreateFullVersionFromMajorMinor(MajorVersion.Get(context), MinorVersion.Get(context)); pModel.Authors = Authors.Get(context); pModel.Owners = Owners.Get(context); pModel.LicenseUrl = LicenseUrl.Get(context); pModel.ProjectUrl = ProjectUrl.Get(context); pModel.IconUrl = IconUrl.Get(context); pModel.RequireLicenseAcceptance = RequireLicenseAcceptance.Get(context); pModel.ReleaseNotes = ReleaseNotes.Get(context); pModel.Copyright = Copyright.Get(context); pModel.Tags = Tags.Get(context); pModel.DirectorySet = DirectorySet.Get(context); pModel.ModelsAssemblyGuid = ModelsAssemblyGuid.Get(context) ?? Guid.NewGuid().ToString(); pModel.ActivitiesAssemblyGuid = ActivitiesAssemblyGuid.Get(context) ?? Guid.NewGuid().ToString(); this.PackageModel.Set(context, pModel); context.Properties.Add("PackageModel", pModel); context.ScheduleActivity(this.Body); }
protected override PackageModel Execute(CodeActivityContext context) { var pModel = new PackageModel(); pModel.Id = PackageId.Get(context); pModel.Description = Description.Get(context); pModel.Version = Version.Get(context); pModel.Authors = Authors.Get(context); pModel.Owners = Owners.Get(context); pModel.LicenseUrl = LicenseUrl.Get(context); pModel.ProjectUrl = ProjectUrl.Get(context); pModel.IconUrl = IconUrl.Get(context); pModel.RequireLicenseAcceptance = RequireLicenseAcceptance.Get(context); pModel.ReleaseNotes = ReleaseNotes.Get(context); pModel.Copyright = Copyright.Get(context); pModel.Tags = Tags.Get(context); pModel.DirectorySet = DirectorySet.Get(context); pModel.ModelsAssemblyGuid = ModelsAssemblyGuid.Get(context); pModel.ActivitiesAssemblyGuid = ActivitiesAssemblyGuid.Get(context); return(pModel); }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (Path.Expression != null) { targetCommand.AddParameter("Path", Path.Get(context)); } if (NestedModules.Expression != null) { targetCommand.AddParameter("NestedModules", NestedModules.Get(context)); } if (Guid.Expression != null) { targetCommand.AddParameter("Guid", Guid.Get(context)); } if (Author.Expression != null) { targetCommand.AddParameter("Author", Author.Get(context)); } if (CompanyName.Expression != null) { targetCommand.AddParameter("CompanyName", CompanyName.Get(context)); } if (Copyright.Expression != null) { targetCommand.AddParameter("Copyright", Copyright.Get(context)); } if (RootModule.Expression != null) { targetCommand.AddParameter("RootModule", RootModule.Get(context)); } if (ModuleVersion.Expression != null) { targetCommand.AddParameter("ModuleVersion", ModuleVersion.Get(context)); } if (Description.Expression != null) { targetCommand.AddParameter("Description", Description.Get(context)); } if (ProcessorArchitecture.Expression != null) { targetCommand.AddParameter("ProcessorArchitecture", ProcessorArchitecture.Get(context)); } if (PowerShellVersion.Expression != null) { targetCommand.AddParameter("PowerShellVersion", PowerShellVersion.Get(context)); } if (ClrVersion.Expression != null) { targetCommand.AddParameter("ClrVersion", ClrVersion.Get(context)); } if (DotNetFrameworkVersion.Expression != null) { targetCommand.AddParameter("DotNetFrameworkVersion", DotNetFrameworkVersion.Get(context)); } if (PowerShellHostName.Expression != null) { targetCommand.AddParameter("PowerShellHostName", PowerShellHostName.Get(context)); } if (PowerShellHostVersion.Expression != null) { targetCommand.AddParameter("PowerShellHostVersion", PowerShellHostVersion.Get(context)); } if (RequiredModules.Expression != null) { targetCommand.AddParameter("RequiredModules", RequiredModules.Get(context)); } if (TypesToProcess.Expression != null) { targetCommand.AddParameter("TypesToProcess", TypesToProcess.Get(context)); } if (FormatsToProcess.Expression != null) { targetCommand.AddParameter("FormatsToProcess", FormatsToProcess.Get(context)); } if (ScriptsToProcess.Expression != null) { targetCommand.AddParameter("ScriptsToProcess", ScriptsToProcess.Get(context)); } if (RequiredAssemblies.Expression != null) { targetCommand.AddParameter("RequiredAssemblies", RequiredAssemblies.Get(context)); } if (FileList.Expression != null) { targetCommand.AddParameter("FileList", FileList.Get(context)); } if (ModuleList.Expression != null) { targetCommand.AddParameter("ModuleList", ModuleList.Get(context)); } if (FunctionsToExport.Expression != null) { targetCommand.AddParameter("FunctionsToExport", FunctionsToExport.Get(context)); } if (AliasesToExport.Expression != null) { targetCommand.AddParameter("AliasesToExport", AliasesToExport.Get(context)); } if (VariablesToExport.Expression != null) { targetCommand.AddParameter("VariablesToExport", VariablesToExport.Get(context)); } if (CmdletsToExport.Expression != null) { targetCommand.AddParameter("CmdletsToExport", CmdletsToExport.Get(context)); } if (DscResourcesToExport.Expression != null) { targetCommand.AddParameter("DscResourcesToExport", DscResourcesToExport.Get(context)); } if (PrivateData.Expression != null) { targetCommand.AddParameter("PrivateData", PrivateData.Get(context)); } if (Tags.Expression != null) { targetCommand.AddParameter("Tags", Tags.Get(context)); } if (ProjectUri.Expression != null) { targetCommand.AddParameter("ProjectUri", ProjectUri.Get(context)); } if (LicenseUri.Expression != null) { targetCommand.AddParameter("LicenseUri", LicenseUri.Get(context)); } if (IconUri.Expression != null) { targetCommand.AddParameter("IconUri", IconUri.Get(context)); } if (ReleaseNotes.Expression != null) { targetCommand.AddParameter("ReleaseNotes", ReleaseNotes.Get(context)); } if (HelpInfoUri.Expression != null) { targetCommand.AddParameter("HelpInfoUri", HelpInfoUri.Get(context)); } if (PassThru.Expression != null) { targetCommand.AddParameter("PassThru", PassThru.Get(context)); } if (DefaultCommandPrefix.Expression != null) { targetCommand.AddParameter("DefaultCommandPrefix", DefaultCommandPrefix.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }