/// <summary>
        /// Converts the assembly attribute representation into a general VersionParameters representation.
        /// </summary>
        /// <returns>A VersionParameters instance containing the encoded information.</returns>
        public VersionParameters ToParameters()
        {
            var parameters = new VersionParameters
            {
                ProductName = ProductName,
                Description = Description,
                Company     = Company,
                Copyright   = Copyright,
                Config      = Config
            };

            var buffer = new VersionParserBuffer(InformationalVersion, "InformationalVersion");

            buffer.ReadVersionMajor(out parameters.Major);
            buffer.ReadVersionMinor(out parameters.Minor);
            buffer.ReadVersionUpdate(out parameters.Update);
            buffer.TryReadVersionHotfix(out parameters.Hotfix);
            buffer.TryReadBuildType(out parameters.BuildType, out parameters.BuildNumber);
            buffer.TryReadSourceFlag(out parameters.IsSource);
            buffer.TryReadFancyName(out parameters.FancyName, ' ');
            buffer.ReadDate(out parameters.Date, ' ');
            buffer.ReadRevision(out parameters.Revision);
            buffer.AssertEnd();

            if (FileVersion != null)
            {
                VerifyMainVersion(FileVersion, parameters);
            }

            return(parameters);
        }
コード例 #2
0
        /// <summary>
        /// Converts the file name representation into a general VersionParameters representation.
        /// </summary>
        /// <returns>A VersionParameters instance containing the encoded information.</returns>
        public VersionParameters ToParameters()
        {
            var parameters = new VersionParameters();

            var buffer = new VersionParserBuffer(FileName, "FileName");

            buffer.ReadProductName(out parameters.ProductName);
            buffer.AssertChar('_');
            buffer.ReadVersionMajor(out parameters.Major);
            buffer.ReadVersionMinor(out parameters.Minor);
            buffer.ReadVersionUpdate(out parameters.Update);
            buffer.TryReadVersionHotfix(out parameters.Hotfix);
            buffer.TryReadBuildType(out parameters.BuildType, out parameters.BuildNumber);
            buffer.TryReadSourceFlag(out parameters.IsSource);
            buffer.TryReadFancyName(out parameters.FancyName, '_');
            buffer.ReadDate(out parameters.Date, '_');
            buffer.AssertEnd();

            return(parameters);
        }