コード例 #1
0
        public static DialogResult Show(this ILogger logger, PatchingProcessException outerException)
        {
            Exception exception = outerException.InnerException ?? outerException;

            string targetFile      = outerException.TargetFile;
            string instructionName = outerException.AssociatedInstruction?.Name;

            string failedObjects = string.Empty;

            if (targetFile != null)
            {
                if (instructionName == null)
                {
                    failedObjects = targetFile;
                }
                else
                {
                    failedObjects = string.Format("{0} -> {1}", instructionName, targetFile);
                }
            }

            var exceptionMessage = new PatchingExceptionMessage
            {
                Exception     = exception,
                FailedObjects = failedObjects,
                Hint          = outerException.GetHint(),
                Message       = exception.Message,
                Operation     = outerException.Step.GetEnumValueText() ?? "Patch a file",
            };

            logger.Error(exceptionMessage.ToString());

            return(logger.Show(exceptionMessage));
        }
コード例 #2
0
        public static DialogResult Show(this ILogger logger, PatchingExceptionMessage message)
        {
            string exceptionMessage = message.ToString();

            logger.Error(exceptionMessage);

            return(MessageBox.Show(exceptionMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error));
        }