当前位置: 首页>>代码示例>>C#>>正文


C# Record.GetInteger方法代码示例

本文整理汇总了C#中Microsoft.Deployment.WindowsInstaller.Record.GetInteger方法的典型用法代码示例。如果您正苦于以下问题:C# Record.GetInteger方法的具体用法?C# Record.GetInteger怎么用?C# Record.GetInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Deployment.WindowsInstaller.Record的用法示例。


在下文中一共展示了Record.GetInteger方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetErrorMessage

        /// <summary>
        /// Gets a formatted Windows Installer error message in a specified language.
        /// </summary>
        /// <param name="errorRecord">Error record containing the error number in the first field, and
        /// error-specific parameters in the other fields.</param>
        /// <param name="culture">The locale for the message.</param>
        /// <returns>The message string, or null if the error message or locale is not found.</returns>
        /// <remarks><p>
        /// Error numbers greater than 2000 refer to MSI "internal" errors, and are always
        /// returned in English.
        /// </p></remarks>
        internal static string GetErrorMessage(Record errorRecord, CultureInfo culture)
        {
            if (errorRecord == null)
            {
                throw new ArgumentNullException("errorRecord");
            }
            int errorNumber;
            if (errorRecord.FieldCount < 1 || (errorNumber = (int) errorRecord.GetInteger(1)) == 0)
            {
                throw new ArgumentOutOfRangeException("errorRecord");
            }

            string msg = Installer.GetErrorMessage(errorNumber, culture);
            if (msg != null)
            {
                errorRecord.FormatString = msg;
                msg = errorRecord.ToString((IFormatProvider)null);
            }
            return msg;
        }
开发者ID:jonnybest,项目名称:coapp,代码行数:31,代码来源:InstallerUtils.cs

示例2: ProcessProgressMessage

        private void ProcessProgressMessage(Record progressRecord)
        {
            // This MSI progress-handling code was mostly borrowed from burn and translated from C++ to C#.

            if (progressRecord == null || progressRecord.FieldCount == 0)
            {
                return;
            }

            int fieldCount = progressRecord.FieldCount;
            int progressType = progressRecord.GetInteger(1);
            string progressTypeString = String.Empty;
            switch (progressType)
            {
                case 0: // Master progress reset
                    if (fieldCount < 4)
                    {
                        return;
                    }

                    this.progressPhase++;

                    this.total = progressRecord.GetInteger(2);
                    if (this.progressPhase == 1)
                    {
                        // HACK!!! this is a hack courtesy of the Windows Installer team. It seems the script planning phase
                        // is always off by "about 50".  So we'll toss an extra 50 ticks on so that the standard progress
                        // doesn't go over 100%.  If there are any custom actions, they may blow the total so we'll call this
                        // "close" and deal with the rest.
                        this.total += 50;
                    }

                    this.moveForward = (progressRecord.GetInteger(3) == 0);
                    this.completed = (this.moveForward ? 0 : this.total); // if forward start at 0, if backwards start at max
                    this.enableActionData = false;

                    this.UpdateProgress();
                    break;

                case 1: // Action info
                    if (fieldCount < 3)
                    {
                        return;
                    }

                    if (progressRecord.GetInteger(3) == 0)
                    {
                        this.enableActionData = false;
                    }
                    else
                    {
                        this.enableActionData = true;
                        this.step = progressRecord.GetInteger(2);
                    }
                    break;

                case 2: // Progress report
                    if (fieldCount < 2 || this.total == 0 || this.progressPhase == 0)
                    {
                        return;
                    }

                    if (this.moveForward)
                    {
                        this.completed += progressRecord.GetInteger(2);
                    }
                    else
                    {
                        this.completed -= progressRecord.GetInteger(2);
                    }

                    this.UpdateProgress();
                    break;

                case 3: // Progress total addition
                    this.total += progressRecord.GetInteger(2);
                    break;
            }
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:79,代码来源:InstallProgressCounter.cs

示例3: UIRecordHandler

        /// <summary>
        /// Handler for external UI messages.
        /// </summary>
        /// <param name="messageType">The type of message.</param>
        /// <param name="messageRecord">The message details.</param>
        /// <param name="buttons">Buttons to show (unused).</param>
        /// <param name="icon">The icon to show (unused).</param>
        /// <param name="defaultButton">The default button (unused).</param>
        /// <returns>How the message was handled.</returns>
        public MessageResult UIRecordHandler(
            InstallMessage messageType,
            Record messageRecord,
            MessageButtons buttons,
            MessageIcon icon,
            MessageDefaultButton defaultButton)
        {
#if False
            Console.WriteLine("Message type {0}: {1}", messageType.ToString(), this.session.FormatRecord(messageRecord));
#endif

            if (!this.session.IsClosed && 1 <= messageRecord.FieldCount)
            {
                switch (messageType)
                {
                    case InstallMessage.ActionStart:
                        // only try to interpret the messages if they're coming from WixRunImmediateUnitTests
                        string action = messageRecord.GetString(1);
                        this.runningTests = Constants.LuxCustomActionName == action;
                        return MessageResult.OK;

                    case InstallMessage.User:
                        if (this.runningTests)
                        {
                            string message = messageRecord.ToString();
                            int id = messageRecord.GetInteger(1);

                            if (Constants.TestIdMinimumSuccess <= id && Constants.TestIdMaximumSuccess >= id)
                            {
                                this.OnMessage(NitVerboses.TestPassed(message));
                                ++this.passes;
                            }
                            else if (Constants.TestIdMinimumFailure <= id && Constants.TestIdMaximumFailure >= id)
                            {
                                this.OnMessage(NitErrors.TestFailed(message));
                                ++this.failures;
                            }
                        }

                        return MessageResult.OK;

                    case InstallMessage.Error:
                    case InstallMessage.FatalExit:
                        this.OnMessage(NitErrors.PackageFailed(this.session.FormatRecord(messageRecord)));
                        return MessageResult.Error;
                }
            }

            return MessageResult.OK;
        }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:59,代码来源:TestRunner.cs


注:本文中的Microsoft.Deployment.WindowsInstaller.Record.GetInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。