/// <summary> /// Implements the build method /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder commandBuilder = new StringBuilder(); // first we need to deploy the vocabularies if (null != args.Rules.Vocabularies) { foreach (BizTalk.MetaDataBuildGenerator.Vocabulary vocabulary in args.Rules.Vocabularies) { string command = string.Format(CultureInfo.InvariantCulture, DeployVocabularyCommand, vocabulary.Name, BizTalk.BizTalkHelper.GetRulesTargetsPath(args.ProjectStructureType), vocabulary.FullName); commandBuilder.Insert(0, Environment.NewLine); commandBuilder.Insert(0, command); } } fileBuilder.Replace(VocabularyCommandTag, commandBuilder.ToString()); commandBuilder.Clear(); // secondly we can deploy the policies if (null != args.Rules.Policies) { foreach (BizTalk.MetaDataBuildGenerator.Policy policy in args.Rules.Policies) { string command = string.Format(CultureInfo.InvariantCulture, DeployPolicyCommand, policy.Name, BizTalk.BizTalkHelper.GetRulesTargetsPath(args.ProjectStructureType), policy.FullName, true); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); command = string.Format(CultureInfo.InvariantCulture, AddRulesCommandFormat, policy.Name, policy.Version); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); } } fileBuilder.Replace(PolicyCommandTag, commandBuilder.ToString()); }
/// <summary> /// Adds the command to the file builder /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder commandBuilder = new StringBuilder(); foreach (BizTalk.MetaDataBuildGenerator.ApplicationResource resource in args.ApplicationDescription.Resources) { if (resource.Type == ResourceTypes.Assembly) { AssemblyResourceAdapter assemblyAdapter = AssemblyResourceAdapter.Create(resource); commandBuilder.Append( string.Format(CultureInfo.InvariantCulture, InstallInGacFormat, BaseResourceAdapter.FormatResourcePath(assemblyAdapter.SourceLocation))); commandBuilder.Append(Environment.NewLine); } else if (resource.Type == ResourceTypes.BizTalkAssembly) { BizTalkAssemblyResourceAdapter btsAdapter = BizTalkAssemblyResourceAdapter.Create(resource); commandBuilder.Append( string.Format(CultureInfo.InvariantCulture, InstallInGacFormat, BaseResourceAdapter.FormatResourcePath(btsAdapter.SourceLocation))); commandBuilder.Append(Environment.NewLine); } } fileBuilder.Replace(CommandTag, commandBuilder.ToString()); }
/// <summary> /// implements file builder /// </summary> /// <param name="args"></param> public void Build(GenerationArgs args) { StringBuilder fileBuilder = new StringBuilder(); fileBuilder.Append(Resources.App_properties); GenerationTags.ReplaceTags(fileBuilder, args); string filePath = args.OutputFolder + @"\" + args.ApplicationDescription.Name + FileExtension; FileHelper.ConfigureForSourceCodeRoot(fileBuilder, args); //The root tag is only replaced here so it is not overwritten when configuring the root path everywhere else if (!string.IsNullOrEmpty(args.SolutionPath)) { fileBuilder.Replace(GenerationTags.SourceCodeRootTag, new DirectoryInfo(Path.GetDirectoryName(args.SolutionPath)).FullName.TrimEnd( new char[] { '\\' })); fileBuilder.Replace("@SolutionName@", Path.GetFileName(args.SolutionPath)); } // We need to replace the version info fileBuilder.Replace("@MajorVersion@", args.MajorVersion); fileBuilder.Replace("@MinorVersion@", args.MinorVersion); fileBuilder.Replace("@AssemblyInfoFiles@", BizTalk.BizTalkHelper.GetAssemblyInfoFiles(BizTalk.BizTalkHelper.ProjectStructureType)); FileHelper.WriteFile(filePath, fileBuilder); _Name = args.ApplicationDescription.Name + FileExtension; }
/// <summary> /// Implements the build method /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder containerBuilder = new StringBuilder(); if (args.UnitTesting.TestContainers.Count > 0) { foreach (BizTalk.MetaDataBuildGenerator.UnitTestContainer container in args.UnitTesting.TestContainers) { if (!string.IsNullOrEmpty(container.Location)) { containerBuilder.Append( string.Format(CultureInfo.InvariantCulture, TestContainerTag, PathHelper.MakeConfigurable(container.Location))); } } string command = string.Format(CultureInfo.InvariantCulture, UnitTestsCommand, containerBuilder.ToString(), args.UnitTesting.TestRunConfigPath); fileBuilder.Replace(CommandTag, command); } else { fileBuilder.Replace(CommandTag, string.Empty); } }
/// <summary> /// Implements the Command Builder /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder sb = new StringBuilder(); foreach (BizTalk.MetaDataBuildGenerator.MetaData.BizTalkHost host in args.BizTalkHosts.Hosts) { string cmd = string.Format(Command, host.Name); sb.AppendLine(cmd); } fileBuilder.Replace(Key, sb.ToString()); }
public void Build(GenerationArgs args) { StringBuilder fileBuilder = new StringBuilder(); fileBuilder.Append(Resources.App_QuickBuild_Debug); GenerationTags.ReplaceTags(fileBuilder, args); string filePath = args.OutputFolder + @"\" + args.ApplicationDescription.Name + FileExtension; FileHelper.WriteFile(filePath, fileBuilder); _name = args.ApplicationDescription.Name + FileExtension; }
public void Build(GenerationArgs args) { StringBuilder fileBuilder = new StringBuilder(); fileBuilder.Append(Resources.App_Build_Release); GenerationTags.ReplaceTags(fileBuilder, args); fileBuilder.Replace("@GenerateBindings@", BizTalk.BizTalkHelper.GenerateBindings.ToString()); string filePath = args.OutputFolder + @"\" + args.ApplicationDescription.Name + FileExtension; FileHelper.WriteFile(filePath, fileBuilder); _name = args.ApplicationDescription.Name + FileExtension; }
/// <summary> /// Implements the command builder execution method /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { if (null == args.ApplicationDescription.ReferencedApplications) { return; } StringBuilder sb = new StringBuilder(); foreach (string referencedApplication in args.ApplicationDescription.ReferencedApplications) { sb.AppendFormat(CommandTemplate, referencedApplication); sb.AppendLine(); } fileBuilder.Replace(Tag, sb.ToString()); }
public void Build(GenerationArgs args) { StringBuilder fileBuilder = new StringBuilder(); fileBuilder.Append(Resources.App_Custom_targets); GenerationTags.ReplaceTags(fileBuilder, args); ExecuteCommandBuilder(new CreateBindingFilesCommandBuilder(), args, fileBuilder); string filePath = args.OutputFolder + @"\" + args.ApplicationDescription.Name + FileExtension; FileHelper.WriteFile(filePath, fileBuilder); _name = args.ApplicationDescription.Name + FileExtension; }
/// <summary> /// Implements the build method /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder commandBuilder = new StringBuilder(); foreach (BizTalk.MetaDataBuildGenerator.SSOApplication app in args.SsoApplications.SSOApps) { string command = string.Format(CultureInfo.InvariantCulture, AddFileCommandFormat, app.ToString(), app.Destination); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); command = string.Format(CultureInfo.InvariantCulture, ImportSSOCommand, app.CompanyName, app.ToString()); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); } fileBuilder.Replace(CommandTag, commandBuilder.ToString()); }
/// <summary> /// Implements the build method public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder commandBuilder = new StringBuilder(); if (args.AssemblyVersionType == Options.AssemblyVersionEnum.Normal) { string command = AssemblyInfoCommand2; commandBuilder.Append(command); } else { string command = AssemblyInfoCommand1; commandBuilder.Append(command); } fileBuilder.Replace(AssemblyInfoCommandTag, commandBuilder.ToString()); }
/// <summary> /// Implements the Command Builder /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder sb = new StringBuilder(); foreach (BizTalk.MetaDataBuildGenerator.MetaData.BizTalkHost host in args.BizTalkHosts.Hosts) { foreach (BizTalk.MetaDataBuildGenerator.MetaData.BizTalkAdapterHandler handler in host.SendHandlers) { if (handler.Included) { string cmd = string.Format(Command, host.Name, handler.AdapterName); sb.AppendLine(cmd); } } } fileBuilder.Replace(Key, sb.ToString()); }
/// <summary> /// Replace the parameter for source code root with the full name /// </summary> /// <param name="sb"></param> /// <param name="args"></param> public static void ReplaceSourceCodeRoot(StringBuilder sb, GenerationArgs args) { string directory; switch (BizTalk.BizTalkHelper.ProjectStructureType) { case Options.ProjectStructureTypeEnum.ACVCSC: directory = Path.GetDirectoryName(args.SolutionPath + "\\..\\"); break; default: directory = Path.GetDirectoryName(args.SolutionPath); break; } if (directory != null) { sb.Replace("$(SourceCodeRootFolder)", new DirectoryInfo(directory).FullName.TrimEnd(new char[] { '\\' })); } }
/// <summary> /// Implements the Command Builder /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder sb = new StringBuilder(); foreach (BizTalk.MetaDataBuildGenerator.MetaData.BizTalkHost host in args.BizTalkHosts.Hosts) { if (host.CanCreate) { List <string> a = new List <string>(); a.Add(host.Name); a.Add(host.Username); a.Add(host.Password); string cmd = string.Format(Command, a.ToArray()); sb.AppendLine(cmd); } } fileBuilder.Replace(Key, sb.ToString()); }
/// <summary> /// Implements the build method /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder commandBuilder = new StringBuilder(); // first we need to remove the policies if (null != args.Rules.Policies) { foreach (BizTalk.MetaDataBuildGenerator.Policy policy in args.Rules.Policies) { string command = string.Format(CultureInfo.InvariantCulture, RemoveRulesCommandFormat, policy.Name, policy.Version); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); } } if (null != args.Rules.PolicyNames) { foreach (string policyName in args.Rules.PolicyNames) { string command = string.Format(CultureInfo.InvariantCulture, RemovePolicyCommand, policyName); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); } } fileBuilder.Replace(PolicyCommandTag, commandBuilder.ToString()); commandBuilder.Clear(); // secondly we can remove the vocabularies if (null != args.Rules.VocabularieNames) { foreach (string vocabularyName in args.Rules.VocabularieNames) { string command = string.Format(CultureInfo.InvariantCulture, RemoveVocabularyCommand, vocabularyName); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); } } fileBuilder.Replace(VocabularyCommandTag, commandBuilder.ToString()); }
/// <summary> /// Implements the build method /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> void ICommandBuilder.Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder commandBuilder = new StringBuilder(); foreach (BizTalk.MetaDataBuildGenerator.ApplicationBinding binding in args.ApplicationBindings.BindingFiles) { StringBuilder sb = new StringBuilder(binding.BindingFilePath); sb.Replace("$(SourceCodeRootFolder)", new DirectoryInfo(Path.GetDirectoryName(args.SolutionPath)).FullName.TrimEnd(new char[] { '\\' })); sb.Replace("$(ProductName)", args.ApplicationDescription.Name); string bindingFilePath = sb.ToString(); if (!File.Exists(bindingFilePath)) { continue; } string command = string.Format(CultureInfo.InvariantCulture, ApplyBindingFileCommand, binding.BindingFilePath); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); } fileBuilder.Replace(CommandTag, commandBuilder.ToString()); }
/// <summary> /// Implements the build method /// </summary> /// <param name="args"></param> /// <param name="fileBuilder"></param> void ICommandBuilder.Build(GenerationArgs args, StringBuilder fileBuilder) { if (!BizTalk.BizTalkHelper.GenerateBindings) { fileBuilder.Replace(CommandTag, string.Empty); return; } string server = string.Empty; string database = string.Empty; BizTalk.BizTalkHelper.GetBizTalkBindingToolDb(out server, out database); string command = string.Format(CultureInfo.InvariantCulture, CreateBindingCommand, server, database); StringBuilder commandBuilder = new StringBuilder(); commandBuilder.Append(command); fileBuilder.Replace(CommandTag, commandBuilder.ToString()); }
/// <summary> /// Implements file builder /// </summary> /// <param name="args"></param> public void Build(GenerationArgs args) { //Setup Template StringBuilder fileBuilder = new StringBuilder(); fileBuilder.Append(Resources.App_targets); GenerationTags.ReplaceTags(fileBuilder, args); //Add Commands ICommandBuilder commandBuilder = new RemoveFromGacCommandBuilder(); commandBuilder.Build(args, fileBuilder); commandBuilder = new InstallInGacCommandBuilder(); commandBuilder.Build(args, fileBuilder); //Write file string filePath = args.OutputFolder + @"\" + args.ApplicationDescription.Name + FileExtension; FileHelper.ConfigureForSourceCodeRoot(fileBuilder, args); FileHelper.WriteFile(filePath, fileBuilder); _name = args.ApplicationDescription.Name + FileExtension; }
public void Build(GenerationArgs args) { StringBuilder fileBuilder = new StringBuilder(); fileBuilder.Append(Resources.App_Custom_Properties); GenerationTags.ReplaceTags(fileBuilder, args); if (args.BuildProperties != null && args.BuildProperties.Properties != null) { StringBuilder sb = new StringBuilder(); foreach (BizTalk.MetaDataBuildGenerator.MetaData.BuildProperty property in args.BuildProperties.Properties) { sb.AppendFormat("<{0}>{1}</{0}>", property.PropertyName, property.PropertyValue); sb.AppendLine(); } fileBuilder.Replace("<!-- @CustomProperties@ -->", sb.ToString()); } string filePath = args.OutputFolder + @"\" + args.ApplicationDescription.Name + FileExtension; FileHelper.WriteFile(filePath, fileBuilder); _name = args.ApplicationDescription.Name + FileExtension; }
public void Build(GenerationArgs args) { StringBuilder fileBuilder = new StringBuilder(); fileBuilder.Append(Resources.App_Build); GenerationTags.ReplaceTags(fileBuilder, args); //Do Commands ExecuteCommandBuilder(new ApplicationResourceCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new BindingFilesCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new CleanHostCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new CreateHostBuilder(), args, fileBuilder); ExecuteCommandBuilder(new CreateHostInstanceBuilder(), args, fileBuilder); ExecuteCommandBuilder(new CreateReceiveHandlerBuilder(), args, fileBuilder); ExecuteCommandBuilder(new CreateSendHandlerBuilder(), args, fileBuilder); ExecuteCommandBuilder(new DeleteHostCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new DeleteSendHandlerBuilder(), args, fileBuilder); ExecuteCommandBuilder(new DeleteReceiveHandlerBuilder(), args, fileBuilder); ExecuteCommandBuilder(new StartHostCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new StopHostCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new UnitTestsCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new AddApplicationReferencesCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new ImportSSOCommandBuilder(), args, fileBuilder); ExecuteCommandBuilder(new AssemblyInfoCommandBuilder(), args, fileBuilder); // $(SourceCodeRootFolder)\Setup\Resources\ReadMe.htm string filePath = args.OutputFolder + @"\" + args.ApplicationDescription.Name + FileExtension; FileHelper.ConfigureForBizTalkInstallVariable(fileBuilder); FileHelper.ConfigureForSourceCodeRoot(fileBuilder, args); FileHelper.ConfigureForReadMe(fileBuilder); FileHelper.WriteFile(filePath, fileBuilder); _name = args.ApplicationDescription.Name + FileExtension; }
/// <summary> /// Executes the command builder /// </summary> /// <param name="args"></param> /// <param name="sb"></param> /// <param name="cmd"></param> private void ExecuteCommandBuilder(ICommandBuilder cmd, GenerationArgs args, StringBuilder sb) { cmd.Build(args, sb); }
private void BroadcastGeneration(object sender, EventArgs e) { GenerationArgs <Bed> arg = (GenerationArgs <Bed>)e; testIterationCounter.text = arg.testIterations.ToString(); for (int i = 0; i < arg.population.Count; i++) { //Debug.Log(String.Format("Bed {0}.", i)); Patch[] patches = arg.population[i].Patches; for (int j = 0; j < patches.Length; j++) { //Debug.Log(String.Format("Patch Square {0}. Output: {1}", j, arg.population[i].Chromosome[j])); } } generationNumber = arg.generationNumber; UpdateGenerationCounter(); generationHighOutput.text = (Decimal.RoundToFactorOf(arg.high, 2.0f) * 100.0f).ToString() + "%"; generationHighSlider.value = arg.high; //Color colourHigh = new Color(); if (arg.high < 0.5f) { generationHighSliderFill.color = swatch[1]; } else if (arg.high > 0.5f && arg.high < 0.8f) { generationHighSliderFill.color = swatch[0]; } else { generationHighSliderFill.color = swatch[2]; } generationAverageOutput.text = (Decimal.RoundToFactorOf(arg.average, 2.0f) * 100.0f).ToString() + "%"; generationAverageSlider.value = arg.average; if (arg.average < 0.5f) { generationAvgSliderFill.color = swatch[1]; } else if (arg.average > 0.5f && arg.average < 0.8f) { generationAvgSliderFill.color = swatch[0]; } else { generationAvgSliderFill.color = swatch[2]; } string spacer = "\n"; string dump = ""; string extraSpaceDecimal = ""; for (int i = 0; i < arg.population.Count; i++) { float round = Decimal.RoundToFactorOf(arg.population[i].Fitness, 2.0f); extraSpaceDecimal = round.ToString().Length <= 3 ? "0" : ""; dump += round.ToString().Replace(',', '.') + extraSpaceDecimal + " "; if (i % 3 == 0 && i != 0) { dump += spacer; } } bedFitnessOutput.text = dump; }
public void Build(GenerationArgs args, StringBuilder fileBuilder) { StringBuilder commandBuilder = new StringBuilder(); foreach (BizTalk.MetaDataBuildGenerator.ApplicationResource resource in args.ApplicationDescription.Resources) { string command = string.Empty; List <string> commandArgs = new List <string>(); switch (resource.Type) { case ResourceTypes.BizTalkBinding: command = AddBindingCommandFormat; BindingResourceAdapter bindingAdapter = BindingResourceAdapter.Create(resource); commandArgs.Add(bindingAdapter.SourceLocation); commandArgs.Add(bindingAdapter.TargetEnvironment); commandArgs.Add(resource.Type); break; case ResourceTypes.BizTalkAssembly: command = AddBizTalkAssemblyCommandFormat; BizTalkAssemblyResourceAdapter bizTalkAssemblyAdapter = BizTalkAssemblyResourceAdapter.Create(resource); commandArgs.Add(BaseResourceAdapter.FormatResourcePath(bizTalkAssemblyAdapter.SourceLocation)); commandArgs.Add(bizTalkAssemblyAdapter.DestinationLocation); commandArgs.Add(bizTalkAssemblyAdapter.Options); break; case ResourceTypes.Assembly: command = AddAssemblyCommandFormat; AssemblyResourceAdapter assemblyAdapter = AssemblyResourceAdapter.Create(resource); commandArgs.Add(BaseResourceAdapter.FormatResourcePath(assemblyAdapter.SourceLocation)); commandArgs.Add(assemblyAdapter.DestinationLocation); commandArgs.Add(assemblyAdapter.Options); break; case ResourceTypes.WebDirectory: command = AddWebDirectoryCommandFormat; WebDirectoryResourceAdapter webDirectoryAdapter = WebDirectoryResourceAdapter.Create(resource); commandArgs.Add(webDirectoryAdapter.SourceLocation); commandArgs.Add(webDirectoryAdapter.DestinationLocation); break; case ResourceTypes.Bam: command = AddBamCommandFormat; BamResourceAdapter bamAdapter = BamResourceAdapter.Create(resource); commandArgs.Add(BaseResourceAdapter.FormatResourcePath(bamAdapter.SourceLocation)); commandArgs.Add(bamAdapter.DestinationLocation); break; case ResourceTypes.File: command = AddFileCommandFormat; FileResourceAdapter fileAdapter = FileResourceAdapter.Create(resource); commandArgs.Add(BaseResourceAdapter.FormatResourcePath(fileAdapter.SourceLocation)); commandArgs.Add(fileAdapter.DestinationLocation); break; case ResourceTypes.PostProcessingScript: command = AddPostProcessingScriptCommandFormat; ScriptResourceAdapter scriptAdapter = ScriptResourceAdapter.Create(resource); commandArgs.Add(BaseResourceAdapter.FormatResourcePath(scriptAdapter.SourceLocation)); commandArgs.Add(scriptAdapter.DestinationLocation); break; case ResourceTypes.PreProcessingScript: command = AddPreProcessingScriptCommandFormat; ScriptResourceAdapter scriptAdapter1 = ScriptResourceAdapter.Create(resource); commandArgs.Add(BaseResourceAdapter.FormatResourcePath(scriptAdapter1.SourceLocation)); commandArgs.Add(scriptAdapter1.DestinationLocation); break; default: break; } command = string.Format(CultureInfo.InvariantCulture, command, commandArgs.ToArray()); commandBuilder.Append(command); commandBuilder.Append(Environment.NewLine); } fileBuilder.Replace(CommandTag, commandBuilder.ToString()); }