コード例 #1
0
        public PackageConfigurationUpdater(PackageConfiguration configuration, IPackageManager manager, string bootstrapperPath = null, IPackageName bootstrapperName = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            packageManager                      = manager;
            packageConfiguration                = configuration;
            bootstrapperExePath                 = bootstrapperPath ?? string.Empty;
            bootstrapperDirectory               = Path.GetDirectoryName(bootstrapperExePath);
            bootstrapperPackageId               = bootstrapperName != null ? bootstrapperName.Id : string.Empty;
            bootstrapperVersion                 = bootstrapperName != null ? bootstrapperName.Version : null;
            packageManager.PackageInstalling   += packageManager_PackageInstalling;
            packageManager.PackageInstalled    += packageManager_PackageInstalled;
            packageManager.PackageUninstalling += packageManager_PackageUninstalling;

            var galleryPath         = Path.Combine(bootstrapperDirectory, GalleryDirectory);
            var galleryFileSystem   = new PhysicalFileSystem(galleryPath);
            var galleryPathResolver = new GalleryPackagePathResolver(galleryPath);

            galleryRepository = new LocalPackageRepository(galleryPathResolver, galleryFileSystem);
        }
コード例 #2
0
        private static IReadOnlyList <XElement> OtherProperties(AssemblyAttributes assemblyAttributes,
                                                                PackageConfiguration packageConfig, IProgress <string> progress)
        {
            var toReturn = new[]
            {
                CreateElementIfNotNull(assemblyAttributes.Title, "AssemblyTitle"),
                CreateElementIfNotNull(assemblyAttributes.Company, "Company"),
                CreateElementIfNotNull(assemblyAttributes.Product, "Product"),

                //And a couple of properties which can be superceded by the package config
                CreateElementIfNotNull(assemblyAttributes.Description, packageConfig?.Description, "Description", progress),
                CreateElementIfNotNull(assemblyAttributes.Copyright, packageConfig?.Copyright, "Copyright", progress),

                assemblyAttributes.Configuration != null
                                        ?
                //If it is included, chances are that the developer has used
                //preprocessor flags which we can't yet process
                //so just leave it in AssemblyInfo file
                new XElement("GenerateAssemblyConfigurationAttribute", false)
                                        : null
            }.Where(x => x != null).ToArray();

            assemblyAttributes.Title       = null;
            assemblyAttributes.Company     = null;
            assemblyAttributes.Description = null;
            assemblyAttributes.Product     = null;
            assemblyAttributes.Copyright   = null;

            return(toReturn);
        }
コード例 #3
0
        public PackageConfiguration Read(Stream stream)
        {
            using (var xmlReader = XmlReader.Create(stream))
            {
                PackageConfiguration config = null;
                while (xmlReader.Read())
                {
                    if (xmlReader.IsStartElement())
                    {
                        switch (xmlReader.Name)
                        {
                        case "packages":
                            config = new PackageConfiguration();
                            break;

                        case "package":
                            var package = ReadPackage(xmlReader);
                            config.Packages.Add(package);
                            break;
                        }
                    }
                }

                return(config);
            }
        }
コード例 #4
0
        public void InstallWebserverPackage()
        {
            var packageConfiguration = new PackageConfiguration();

            var website = new Website();

            var product = new Product();

            var setupStep = new SetupStep();


            var package = new Package
            {
                Id                   = 92,
                Name                 = "TestPackage_1.0.17.zip",
                IsDeleted            = false,
                CreatedAt            = DateTime.UtcNow.AddDays(-20),
                UpdatedAt            = DateTime.UtcNow.AddDays(-18),
                PackageUrl           = @"\\path\to\test\package\TestPackage_1.0.17.zip",
                Version              = new Version(1, 0, 17),
                PackageConfiguration = null,
                Websites             = null,
                Product              = null,
                SetupSteps           = null
            };
        }
コード例 #5
0
        public void UnitTestGetWindowsAzurePackageConfiguration()
        {
            ConfigSectionConfigurationSource configSectionConfigurationSource = new ConfigSectionConfigurationSource();
            PackageConfiguration             packageConfiguration             = configSectionConfigurationSource.GetWindowsAzurePackageConfiguration("myArbitraryPackageName");

            Assert.IsNotNull(packageConfiguration);
        }
コード例 #6
0
ファイル: Launcher.cs プロジェクト: spacelabswc/bonsai
        internal static int LaunchPackageManager(
            PackageConfiguration packageConfiguration,
            string editorRepositoryPath,
            string editorPath,
            PackageIdentity editorPackageName,
            bool updatePackages)
        {
            EditorBootstrapper.EnableVisualStyles();
            using (var packageManagerDialog = new PackageManagerDialog(ProjectFramework, editorRepositoryPath))
                using (var monitor = new PackageConfigurationUpdater(
                           ProjectFramework,
                           packageConfiguration,
                           packageManagerDialog.PackageManager,
                           editorPath,
                           editorPackageName))
                {
                    packageManagerDialog.DefaultTab = updatePackages ? PackageManagerTab.Updates : PackageManagerTab.Browse;
                    if (packageManagerDialog.ShowDialog() == DialogResult.OK)
                    {
                        AppResult.SetResult(packageManagerDialog.InstallPath);
                    }

                    return(Program.NormalExitCode);
                }
        }
コード例 #7
0
        private static void ConstrainPackageReferences(
            IReadOnlyList <PackageReference> rawPackageReferences,
            PackageConfiguration packageConfig
            )
        {
            var dependencies = packageConfig.Dependencies;

            if (dependencies == null || rawPackageReferences == null)
            {
                return;
            }

            var packageIdConstraints = dependencies.Select(dependency =>
            {
                var packageId  = dependency.Attribute("id").Value;
                var constraint = dependency.Attribute("version").Value;

                return(new { packageId, constraint });
            }).ToList();

            foreach (var packageReference in rawPackageReferences)
            {
                var matchingPackage = packageIdConstraints
                                      .SingleOrDefault(dependency =>
                                                       packageReference.Id.Equals(dependency.packageId, StringComparison.OrdinalIgnoreCase)
                                                       );

                if (matchingPackage != null)
                {
                    packageReference.Version = matchingPackage.constraint;
                }
            }
        }
コード例 #8
0
        public static IEnumerable <Configuration.PackageReference> GetAssemblyPackageReferences(
            PackageConfiguration configuration,
            IEnumerable <string> assemblyNames,
            IDictionary <string, Configuration.PackageReference> packageMap)
        {
            var dependencies = new List <Configuration.PackageReference>();

            foreach (var assemblyName in assemblyNames)
            {
                var assemblyLocation = ConfigurationHelper.GetAssemblyLocation(configuration, assemblyName);
                if (assemblyLocation != null)
                {
                    var pathElements = assemblyLocation.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
                    if (pathElements.Length > 1 && pathElements[0] == RepositoryPath)
                    {
                        Configuration.PackageReference package;
                        if (packageMap.TryGetValue(pathElements[1], out package))
                        {
                            dependencies.Add(package);
                        }
                    }
                }
            }

            return(dependencies);
        }
コード例 #9
0
        internal static DeploymentCreateForecastWorker[] GetDeploymentCreateForecastWorkers()
        {
            IConfigurationSource configurationSource = GetConfigurationSource();
            ArrayList            list = new ArrayList();

            foreach (DeploymentCreateConfiguration deploymentCreateConfiguration in configurationSource.GetWindowsAzureDeploymentCreateConfigurations())
            {
                SubscriptionConfiguration subscriptionConfiguration = configurationSource.GetWindowsAzureSubscriptionConfiguration(deploymentCreateConfiguration.SubscriptionConfigurationId);
                PackageConfiguration      packageConfiguration      = configurationSource.GetWindowsAzurePackageConfiguration(deploymentCreateConfiguration.WindowsAzurePackageId);
                foreach (ScheduleDefinitionConfiguration scheduleDefinitionConfiguration in deploymentCreateConfiguration.Schedules)
                {
                    ScheduleDay[] scheduleDays = GetScheduleDaysFromScheduleConfiguration(scheduleDefinitionConfiguration);
                    Uri           packageUrl   = Blob.GetUrl(packageConfiguration.StorageAccountName, packageConfiguration.ContainerName, packageConfiguration.BlobName);
                    DeploymentCreateForecastWorker deploymentCreateForecastWorker = new DeploymentCreateForecastWorker(
                        new Deployment(),
                        new Operation(),
                        subscriptionConfiguration.SubscriptionId,
                        subscriptionConfiguration.CertificateThumbprint,
                        deploymentCreateConfiguration.ServiceName,
                        deploymentCreateConfiguration.DeploymentSlot,
                        scheduleDays,
                        deploymentCreateConfiguration.DeploymentName,
                        packageUrl,
                        deploymentCreateConfiguration.DeploymentLabel,
                        deploymentCreateConfiguration.PackageConfigurationFilePath,
                        deploymentCreateConfiguration.StartDeployment,
                        deploymentCreateConfiguration.TreatWarningsAsError,
                        deploymentCreateConfiguration.PollingIntervalInMinutes);
                    list.Add(deploymentCreateForecastWorker);
                }
            }

            return((DeploymentCreateForecastWorker[])list.ToArray(typeof(DeploymentCreateForecastWorker)));
        }
コード例 #10
0
ファイル: ScriptExtensions.cs プロジェクト: aalmada/bonsai
 public ScriptExtensions(PackageConfiguration configuration, string outputPath)
 {
     packageConfiguration = configuration;
     packageMap           = DependencyInspector.GetPackageReferenceMap(configuration);
     assemblyFolder       = new TempDirectory(outputPath);
     ProjectFileName      = Path.GetFullPath(DefaultProjectFileName);
 }
コード例 #11
0
        public JsonResult AddPackageDetails(List <ProductSubProductItems> lstProductSubProductItems, string PackageName)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.SuccessMessage
            };

            try
            {
                PackageConfiguration package = new PackageConfiguration()
                {
                    PackageName    = PackageName,
                    PackageDetails = JsonConvert.SerializeObject(lstProductSubProductItems),
                    Date           = DateTime.Now,
                    EmployeeID     = "",
                };
                Entity.PackageConfigurations.Add(package);
                Entity.SaveChanges();
                responseData.Message = common.SuccessMessage;
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
コード例 #12
0
        // TODO: Validate more
        /// <inheritdoc/>
        public async Task <ValidatePackageConfigurationResult> Validate(PackageConfiguration packageConfiguration)
        {
            var validatePackageConfigurationResult = new ValidatePackageConfigurationResult
            {
                IsValid  = true,
                LogLevel = LogLevel.Info,
                Message  = "Package configuration is valid."
            };

            foreach (var item in packageConfiguration.Objects)
            {
                foreach (var objectListItem in item.Value)
                {
                    if (objectListItem.Mode == InstallMode.Migrate && objectListItem.Guid == null)
                    {
                        validatePackageConfigurationResult.IsValid  = false;
                        validatePackageConfigurationResult.LogLevel = LogLevel.Error;
                        validatePackageConfigurationResult.Message  = $"Objectlistitem with target {objectListItem.Target} is invalid, due to its InstallMode being Migrate and not having a Guid!";

                        return(validatePackageConfigurationResult);
                    }
                }
            }
            return(validatePackageConfigurationResult);
        }
コード例 #13
0
        private void AddPackageNodes(XElement mainPropertyGroup, PackageConfiguration packageConfiguration)
        {
            if (packageConfiguration == null)
            {
                return;
            }

            //Add those properties not already covered by the project properties

            AddIfNotNull(mainPropertyGroup, "Authors", packageConfiguration.Authors);
            AddIfNotNull(mainPropertyGroup, "PackageIconUrl", packageConfiguration.IconUrl);
            AddIfNotNull(mainPropertyGroup, "PackageId", packageConfiguration.Id);
            AddIfNotNull(mainPropertyGroup, "PackageLicenseUrl", packageConfiguration.LicenseUrl);
            AddIfNotNull(mainPropertyGroup, "PackageProjectUrl", packageConfiguration.ProjectUrl);
            AddIfNotNull(mainPropertyGroup, "PackageReleaseNotes", packageConfiguration.ReleaseNotes);
            AddIfNotNull(mainPropertyGroup, "PackageTags", packageConfiguration.Tags);

            if (packageConfiguration.Id != null && packageConfiguration.Tags == null)
            {
                mainPropertyGroup.Add(new XElement("PackageTags", "Library"));
            }

            if (packageConfiguration.RequiresLicenseAcceptance)
            {
                mainPropertyGroup.Add(new XElement("PackageRequireLicenseAcceptance", "true"));
            }
        }
コード例 #14
0
        private void AddPackageNodes(XElement mainPropertyGroup, PackageConfiguration packageConfiguration, AssemblyAttributes attributes)
        {
            if (packageConfiguration == null)
            {
                return;
            }

            AddIfNotNull(mainPropertyGroup, "Company", attributes?.Company);
            AddIfNotNull(mainPropertyGroup, "Authors", packageConfiguration.Authors);
            AddIfNotNull(mainPropertyGroup, "Copyright", packageConfiguration.Copyright);
            AddIfNotNull(mainPropertyGroup, "Description", packageConfiguration.Description);
            AddIfNotNull(mainPropertyGroup, "PackageIconUrl", packageConfiguration.IconUrl);
            AddIfNotNull(mainPropertyGroup, "PackageId", packageConfiguration.Id);
            AddIfNotNull(mainPropertyGroup, "PackageLicenseUrl", packageConfiguration.LicenseUrl);
            AddIfNotNull(mainPropertyGroup, "PackageProjectUrl", packageConfiguration.ProjectUrl);
            AddIfNotNull(mainPropertyGroup, "PackageReleaseNotes", packageConfiguration.ReleaseNotes);
            AddIfNotNull(mainPropertyGroup, "PackageTags", packageConfiguration.Tags);
            AddIfNotNull(mainPropertyGroup, "Version", packageConfiguration.Version);

            if (packageConfiguration.Id != null && packageConfiguration.Tags == null)
            {
                mainPropertyGroup.Add(new XElement("PackageTags", "Library"));
            }

            if (packageConfiguration.RequiresLicenseAcceptance)
            {
                mainPropertyGroup.Add(new XElement("PackageRequireLicenseAcceptance", "true"));
            }
        }
コード例 #15
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.CheckSecurity();

            this.ConfiguredPackages = PackageConfiguration.GetConfiguredPackages().ToList();
        }
コード例 #16
0
ファイル: ConfigService.cs プロジェクト: alexi-t/spm
        public void SetTag(string tag)
        {
            PackageConfiguration root = ReadConfig();

            root.Tag = tag;

            WriteConfig(root);
        }
コード例 #17
0
        public static BuildPackageArgs BuildPackage(
            PackageConfiguration packageConfiguration,
            NameValueCollection parameters)
        {
            var args = new BuildPackageArgs(packageConfiguration, parameters);

            CorePipeline.Run("pintle.buildPackage", args);
            return(args);
        }
コード例 #18
0
        public static BuildPackageArgs BuildPackage(
            PackageConfiguration packageConfiguration,
            IDictionary <string, string> parameters)
        {
            var args = new BuildPackageArgs(packageConfiguration, parameters);

            CorePipeline.Run("pintle.buildPackage", args);
            return(args);
        }
コード例 #19
0
ファイル: ConfigService.cs プロジェクト: alexi-t/spm
        public void CreateConfig(string name, string hash)
        {
            var root = new PackageConfiguration
            {
                Name = name
            };

            WriteConfig(root);
        }
コード例 #20
0
ファイル: Launcher.cs プロジェクト: aalmada/bonsai
        static string LaunchPackageBootstrapper(
            PackageConfiguration packageConfiguration,
            string editorRepositoryPath,
            string editorPath,
            string targetPath,
            string packageId,
            Func <IPackageManager, Task> installPackage)
        {
            EnableVisualStyles();
            var installPath       = string.Empty;
            var executablePackage = default(IPackage);
            var packageManager    = CreatePackageManager(editorRepositoryPath);

            using (var monitor = new PackageConfigurationUpdater(packageConfiguration, packageManager, editorPath))
            {
                packageManager.PackageInstalling += (sender, e) =>
                {
                    var package = e.Package;
                    if (package.Id == packageId && e.Cancel)
                    {
                        executablePackage = package;
                    }
                };

                PackageHelper.RunPackageOperation(packageManager, () => installPackage(packageManager));
            }

            if (executablePackage != null)
            {
                if (string.IsNullOrEmpty(targetPath))
                {
                    var entryPoint = executablePackage.Id + NuGet.Constants.BonsaiExtension;
                    var message    = string.Format(Resources.InstallExecutablePackageWarning, executablePackage.Id);
                    var result     = MessageBox.Show(message, Resources.InstallExecutablePackageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (result == DialogResult.Yes)
                    {
                        using (var dialog = new SaveFolderDialog())
                        {
                            dialog.FileName = executablePackage.Id;
                            if (dialog.ShowDialog() == DialogResult.OK)
                            {
                                targetPath = dialog.FileName;
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(targetPath))
                {
                    var targetFileSystem = new PhysicalFileSystem(targetPath);
                    installPath = PackageHelper.InstallExecutablePackage(executablePackage, targetFileSystem);
                }
            }
            return(installPath);
        }
コード例 #21
0
        private async Task BuildPackage(BuildContext context, PackageConfiguration package)
        {
            var bundles = new List <AssetBundle>();

            foreach (var bundle in package.Bundles)
            {
                bundles.Add(await BuildBundle(context, bundle));
            }

            await _packager.Package(package.Name, bundles);
        }
コード例 #22
0
ファイル: LoaderResource.cs プロジェクト: spacelabswc/bonsai
        public LoaderResource(PackageConfiguration configuration)
        {
            var currentEvidence = AppDomain.CurrentDomain.Evidence;
            var setupInfo       = AppDomain.CurrentDomain.SetupInformation;

            reflectionDomain = AppDomain.CreateDomain("ReflectionOnly", currentEvidence, setupInfo);
            Loader           = (TLoader)reflectionDomain.CreateInstanceAndUnwrap(
                typeof(TLoader).Assembly.FullName,
                typeof(TLoader).FullName,
                false, (BindingFlags)0, null,
                new[] { configuration }, null, null);
        }
コード例 #23
0
ファイル: ConfigService.cs プロジェクト: alexi-t/spm
 public bool TryGetConfig(out PackageConfiguration packageConfiguration)
 {
     packageConfiguration = null;
     try
     {
         packageConfiguration = ReadConfig();
         return(true);
     }
     catch (FileNotFoundException)
     {
         return(false);
     }
 }
コード例 #24
0
ファイル: Launcher.cs プロジェクト: aalmada/bonsai
 internal static string LaunchPackageBootstrapper(
     PackageConfiguration packageConfiguration,
     string editorRepositoryPath,
     string editorPath,
     IPackage package)
 {
     return(LaunchPackageBootstrapper(
                packageConfiguration,
                editorRepositoryPath,
                editorPath,
                null,
                package.Id,
                packageManager => packageManager.StartInstallPackage(package)));
 }
コード例 #25
0
ファイル: Launcher.cs プロジェクト: spacelabswc/bonsai
        internal static int LaunchExportPackage(PackageConfiguration packageConfiguration, string fileName, string editorFolder)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                Console.WriteLine("No workflow file was specified.");
                return(Program.NormalExitCode);
            }

            EditorBootstrapper.EnableVisualStyles();
            var directoryName = Path.GetDirectoryName(fileName);

            if (Path.GetFileName(directoryName) != Path.GetFileNameWithoutExtension(fileName))
            {
                MessageBox.Show(
                    string.Format(Resources.ExportPackageInvalidDirectory,
                                  Path.GetFileNameWithoutExtension(fileName)),
                    typeof(Launcher).Namespace,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return(Program.NormalExitCode);
            }

            Manifest manifest;
            var      metadataPath = Path.ChangeExtension(fileName, NuGetConstants.ManifestExtension);

            try { manifest = PackageBuilderHelper.CreatePackageManifest(metadataPath); }
            catch (XmlException ex) { return(ShowManifestReadError(metadataPath, ex.Message)); }
            catch (InvalidOperationException ex)
            {
                return(ShowManifestReadError(
                           metadataPath,
                           ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }

            bool updateDependencies;
            var  builder = PackageBuilderHelper.CreateExecutablePackage(fileName, manifest, packageConfiguration, out updateDependencies);

            using (var builderDialog = new PackageBuilderDialog())
            {
                builderDialog.MetadataPath     = Path.ChangeExtension(fileName, NuGetConstants.ManifestExtension);
                builderDialog.InitialDirectory = Path.Combine(editorFolder, NuGet.Constants.GalleryDirectory);
                builderDialog.SetPackageBuilder(builder);
                if (updateDependencies)
                {
                    builderDialog.UpdateMetadataVersion();
                }
                builderDialog.ShowDialog();
                return(Program.NormalExitCode);
            }
        }
コード例 #26
0
        private static IReadOnlyList <XElement> SigningProperties(AssemblyAttributes assemblyAttributes,
                                                                  PackageConfiguration packageConfig, ILogger logger)
        {
            var toReturn = new[]
            {
                assemblyAttributes.IsSigned ? new XElement("SignAssembly", true) : null,
                assemblyAttributes.KeyFile != null?CreateElementIfNotNullOrEmpty(assemblyAttributes.DelaySign, "DelaySign") : null,
                    CreateElementIfNotNullOrEmpty(assemblyAttributes.KeyFile, "AssemblyOriginatorKeyFile")
            }.Where(x => x != null).ToArray();

            assemblyAttributes.DelaySign = null;
            assemblyAttributes.KeyFile   = null;

            return(toReturn);
        }
コード例 #27
0
        public static IObservable <TypeVisualizerDescriptor> GetVisualizerTypes(PackageConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            var assemblies = configuration.AssemblyReferences.Select(reference => reference.AssemblyName);

            return(Observable.Using(
                       () => new LoaderResource <TypeVisualizerLoader>(configuration),
                       resource => from assemblyRef in assemblies.ToObservable()
                       let typeVisualizers = resource.Loader.GetReflectionTypeVisualizerAttributes(assemblyRef)
                                             from typeVisualizer in typeVisualizers
                                             select typeVisualizer));
        }
コード例 #28
0
ファイル: Launcher.cs プロジェクト: aalmada/bonsai
 internal static string LaunchPackageBootstrapper(
     PackageConfiguration packageConfiguration,
     string editorRepositoryPath,
     string editorPath,
     string targetPath,
     string packageId,
     SemanticVersion packageVersion)
 {
     return(LaunchPackageBootstrapper(
                packageConfiguration,
                editorRepositoryPath,
                editorPath,
                targetPath,
                packageId,
                packageManager => packageManager.StartInstallPackage(packageId, packageVersion)));
 }
コード例 #29
0
        private PackageConfiguration ExtractPackageConfiguration(
            XDocument nuspec, XNamespace ns
            )
        {
            var metadata = nuspec?.Element(ns + "package")?.Element(ns + "metadata");

            if (metadata == null)
            {
                return(null);
            }

            var id = metadata.Element(ns + "id")?.Value;

            if (id == "$id$")
            {
                id = null;
            }

            var version = metadata.Element(ns + "version")?.Value;

            if (version == "$version$")
            {
                version = null;
            }

            var dependencies = metadata.Element(ns + "dependencies")
                               ?.Elements(ns + "dependency")
                               .ToList();

            var packageConfig = new PackageConfiguration {
                Id           = id,
                Version      = version,
                Authors      = GetElement(metadata, ns + "authors"),
                Description  = GetElement(metadata, ns + "description"),
                Copyright    = GetElement(metadata, ns + "copyright"),
                LicenseUrl   = GetElement(metadata, ns + "licenseUrl"),
                ProjectUrl   = GetElement(metadata, ns + "projectUrl"),
                IconUrl      = GetElement(metadata, ns + "iconUrl"),
                Tags         = GetElement(metadata, ns + "tags"),
                ReleaseNotes = GetElement(metadata, ns + "releaseNotes"),
                RequiresLicenseAcceptance = metadata.Element(ns + "requireLicenseAcceptance")?.Value != null && bool.Parse(metadata.Element(ns + "requireLicenseAcceptance")?.Value),
                Dependencies = dependencies
            };

            return(packageConfig);
        }
コード例 #30
0
ファイル: Launcher.cs プロジェクト: richbryant/bonsai
        internal static int LaunchWorkflowEditor(
            PackageConfiguration packageConfiguration,
            ScriptExtensions scriptEnvironment,
            string editorRepositoryPath,
            string initialFileName,
            float editorScale,
            bool start,
            bool debugging,
            Dictionary <string, string> propertyAssignments)
        {
            var elementProvider    = WorkflowElementLoader.GetWorkflowElementTypes(packageConfiguration);
            var visualizerProvider = TypeVisualizerLoader.GetTypeVisualizerDictionary(packageConfiguration);
            var packageManager     = CreatePackageManager(editorRepositoryPath);
            var updatesAvailable   = Task.Factory.StartNew(() =>
            {
                try
                {
                    return(packageManager.SourceRepository.GetUpdates(
                               packageManager.LocalRepository.GetPackages(),
                               includePrerelease: false,
                               includeAllVersions: false).Any());
                }
                catch { return(false); }
            });

            EnableVisualStyles();
            using (var mainForm = new MainForm(elementProvider, visualizerProvider, scriptEnvironment, editorScale))
            {
                updatesAvailable.ContinueWith(task => mainForm.UpdatesAvailable = task.Result);
                mainForm.FileName = initialFileName;
                mainForm.PropertyAssignments.AddRange(propertyAssignments);
                mainForm.LoadAction =
                    start && debugging ? LoadAction.Start :
                    start ? LoadAction.StartWithoutDebugging :
                    LoadAction.None;
                Application.Run(mainForm);
                var editorFlags = mainForm.UpdatesAvailable ? EditorFlags.UpdatesAvailable : EditorFlags.None;
                if (scriptEnvironment.DebugScripts)
                {
                    editorFlags |= EditorFlags.DebugScripts;
                }
                AppResult.SetResult(editorFlags);
                AppResult.SetResult(mainForm.FileName);
                return((int)mainForm.EditorResult);
            }
        }
コード例 #31
0
ファイル: OLEDBConnection.cs プロジェクト: japj/vulcan
        public override void Emit(SsisEmitterContext context)
        {
            Initialize(context);

            if (!ReusedExisting)
            {
                string connectionString = ConnectionString;

                ConnectionManager.ConnectionString = connectionString;
                SetProperty("RetainSameConnection", RetainSameConnection);

                // Need to unwind this and split it out logically.
                const string DtsConfigHeader = @"<DTSConfiguration>
                                    <DTSConfigurationHeading><DTSConfigurationFileInfo /></DTSConfigurationHeading>";
                const string DtsPropertyConfig = @"<Configuration ConfiguredType=""Property"" Path=""\Package.Connections[{0}].Properties[{1}]"" ValueType=""String"">
                                            <ConfiguredValue>{2}</ConfiguredValue>
                                         </Configuration>";
                const string DtsConfigFooter = "</DTSConfiguration>";

                string configDirectory = PathManager.GetTargetSubpath(Properties.Settings.Default.SubpathPackageConfigurationProjectLocation);
                string configFile = PathManager.AddSubpath(configDirectory, String.Format(CultureInfo.InvariantCulture, "{0}.{1}", Name, Properties.Resources.ExtensionDtsConfigurationFile));

                // Need to create the Target Directory :)
                Directory.CreateDirectory(configDirectory);
                using (var sw = new StreamWriter(configFile, false, Encoding.Unicode))
                {
                    sw.Write(DtsConfigHeader);
                    sw.Write(DtsPropertyConfig, Name, "ConnectionString", OriginalConnectionString);
                    sw.Write(DtsConfigFooter);
                    sw.Flush();
                    sw.Close();
                }

                var pc = new PackageConfiguration(Name);
                pc.Emit(context);
            }
        }