/// <summary>
        /// Parses build information from an INI file.
        /// </summary>
        /// <param name="iniFile">The INI file.</param>
        private void INIParse(IniFile iniFile)
        {
            var versionSection = iniFile.GetSection(VERSION_SECTION);

            if (versionSection == null)
            {
                throw new ParseException("[" + VERSION_SECTION + "] section not found from " + iniFile.FileName);
            }

            ProductVersionInfo = new ProductVersionInfo();
            ProductVersionInfo.Parse(versionSection);

            var fileKeys = iniFile.GetSectionKeys(FILES_SECTION);

            if (fileKeys == null)
            {
                return;
            }

            foreach (string key in fileKeys)
            {
                string[] parts = iniFile.GetStringValue(FILES_SECTION, key, string.Empty).Split(',');

                try
                {
                    var fileInfo = new T();
                    fileInfo.Parse(parts);

                    FileInfos.Add(fileInfo);
                }
                catch (FormatException) { UpdaterLogger.Log("FormatException when parsing file information, INI key " + key); }
                catch (ParseException) { UpdaterLogger.Log("ParseException when parsing file information, INI key: " + key); }
            }
        }
示例#2
0
        internal NuGetUpdater(UpdaterParameters parameters, UpdaterLogger log)
        {
            _parameters = parameters.Validate();
            _log        = log;

            PackageFeed.Logger = _log;
        }
示例#3
0
        public async Task GivenUnspecifiedTarget_NoUpdateIsMade()
        {
            var parameters = new UpdaterParameters
            {
                SolutionRoot   = "MySolution.sln",
                UpdateTarget   = FileType.Unspecified,
                TargetVersions = { "stable" },
                Feeds          = { TestFeed },
            };

            var logger = new UpdaterLogger(Console.Out);

            var updater = new NuGetUpdater(parameters, logger);

            await updater.UpdatePackages(CancellationToken.None);

            Assert.IsTrue(logger.GetUpdates().None());
        }