コード例 #1
0
 public void EndSection(string message, params object[] messageArgs)
 {
     if (externalLogger != null)
     {
         externalLogger.EndSection(message, messageArgs);
     }
 }
コード例 #2
0
        public bool Execute()
        {
            bool flag = true;
            IXmlTransformationLogger logger = (IXmlTransformationLogger) new Log4netTransformationLogger();

            try
            {
                logger.StartSection(string.Format((IFormatProvider)CultureInfo.CurrentCulture, "Transforming Source File: {0}", new object[1] {
                    (object)this.Source
                }), new object[0]);
                XmlTransformableDocument document = this.OpenSourceFile(this.Source);
                logger.LogMessage(string.Format((IFormatProvider)CultureInfo.CurrentCulture, "Applying Transform File: {0}", new object[1] {
                    (object)this.Transform
                }), new object[0]);
                flag = this.OpenTransformFile(this.Transform, logger).Apply((XmlDocument)document);
                if (flag)
                {
                    logger.LogMessage(string.Format((IFormatProvider)CultureInfo.CurrentCulture, "Output File: {0}", new object[1] {
                        (object)this.Destination
                    }), new object[0]);
                    this.SaveTransformedFile(document, this.Destination);
                }
            }
            catch (XmlException ex)
            {
                Uri uri = new Uri(ex.SourceUri);
                logger.LogError(uri.LocalPath, ex.LineNumber, ex.LinePosition, ex.Message, new object[0]);
                flag = false;
            }
            catch (Exception ex)
            {
                logger.LogErrorFromException(ex);
                flag = false;
            }
            finally
            {
                logger.EndSection(string.Format((IFormatProvider)CultureInfo.CurrentCulture, flag ? "Transformation succeeded" : "Transformation failed", new object[0]), new object[0]);
            }
            return(flag);
        }
コード例 #3
0
 public void EndSection(string message, params object[] messageArgs) => _externalLogger?.EndSection(message, messageArgs);