/// <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());
        }
Beispiel #2
0
        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());
        }