예제 #1
0
        private static StringKeyValueCollection ParseCommandLineArgs(string[] args)
        {
            if (args == null || args.Length == 0)
            {
                return(new StringKeyValueCollection());
            }

            return(StringKeyValueCollection.Parse(string.Join(Environment.NewLine, args)));
        }
예제 #2
0
        public InstallerDefinition(string latestTxtFileContent)
        {
            this.LatestTxtContent = latestTxtFileContent;

            var latestTxtProperties = StringKeyValueCollection.Parse(latestTxtFileContent);

            this.InstallerID           = new Guid(latestTxtProperties[AntPropertyNames.InstallerUniqueID].Value);
            this.Version               = new VersionNumber(latestTxtProperties[AntPropertyNames.InstallerVersion].Value);
            this.PublisherEmailAddress = latestTxtProperties[AntPropertyNames.TriggeredBy].Value;

            if (latestTxtProperties.Contains(AntPropertyNames.CustomizedInstaller))
            {
                this.IsCustomizedInstaller = 0 == string.Compare("true", latestTxtProperties[AntPropertyNames.CustomizedInstaller].Value);
            }
        }
예제 #3
0
        private void AppendInstallerContent(InstallerDefinition installerDefinition, IServerPath branchServerPath)
        {
            var installerContentTxtPath = branchServerPath.Subpath(Constants.Versions)
                                          .Subpath(installerDefinition.Version.ToString())
                                          .Subpath(Constants.InstallerContentTxt);

            foreach (var keyValue in StringKeyValueCollection.Parse(_sourceControlAdapter.ReadTextFile(installerContentTxtPath)))
            {
                if (keyValue.Value.StartsWith("$/"))
                {
                    installerDefinition.Components.Add(new InstallerDefinition.ComponentDefinition(keyValue.Name, _sourceControlAdapter.CreateServerPath(keyValue.Value)));
                }
                else //backward compatibility with the installers up to 1.5.x
                {
                    installerDefinition.Components.Add(new InstallerDefinition.ComponentDefinition(keyValue.Name, _sourceControlAdapter.CreateServerPath(ConfigurationManager.AppSettings[ConfigurationKeys.oldDistributionPath]).Subpath(keyValue.Value)));
                }
            }
        }
예제 #4
0
        public CommandLineArgs Parse(string[] args)
        {
            if (args.Length == 0)
            {
                throw new MissingCommandLineArgumentsException();
            }

            var inputFilesArgs = args.Where(a => !a.Contains("=")).ToArray();

            if (inputFilesArgs.Length == 0 || inputFilesArgs.Length > 2)
            {
                throw new InvalidCommandLineArgumentsException();
            }

            var commandLineArgs = new CommandLineArgs(inputFilesArgs[0]);

            if (inputFilesArgs.Length == 2)
            {
                commandLineArgs.NavigationPlanFile = Optional <string> .Some(inputFilesArgs[1]);
            }


            var optionArgs = StringKeyValueCollection.Parse(args.Where(a => a.Contains("=")).ToArray());

            var outpFolderOption = optionArgs.FirstOrDefault(o => 0 == string.Compare(o.Name, OptionNames.outputFolder, true));

            if (outpFolderOption != null)
            {
                if (string.IsNullOrEmpty(outpFolderOption.Value))
                {
                    throw new InvalidCommandLineArgumentsException($"If you specify {OptionNames.outputFolder} paramters you must provide the path for the folder");
                }

                commandLineArgs.OutputFolder = Optional <string> .Some(outpFolderOption.Value);
            }


            return(commandLineArgs);
        }
예제 #5
0
 private StringKeyValueCollection ReadTriggerIniContent(Folders.IFileHolder fileHolder)
 {
     _logger.Info($"Reading {fileHolder.GetServerPath().AsString()}");
     return(StringKeyValueCollection.Parse(fileHolder.GetTextContent()));
 }