Ejemplo n.º 1
0
 private Exception WrapException(Exception ex, XmlNode node)
 {
     return(XmlNodeException.Wrap(ex, node));
 }
Ejemplo n.º 2
0
        internal void Execute(XmlElementContext context, string argumentString)
        {
            Debug.Assert(this.context == null && this.argumentString == null, "Don't call Execute recursively");
            Debug.Assert(this.logger == null, "Logger wasn't released from previous execution");

            if (this.context == null && this.argumentString == null)
            {
                bool error          = false;
                bool startedSection = false;

                try {
                    this.context        = context;
                    this.argumentString = argumentString;
                    this.arguments      = null;

                    if (ShouldExecuteTransform())
                    {
                        startedSection = true;

                        Log.StartSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformBeginExecutingMessage, TransformNameLong);
                        Log.LogMessage(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformStatusXPath, context.XPath);

                        if (ApplyTransformToAllTargetNodes)
                        {
                            ApplyOnAllTargetNodes();
                        }
                        else
                        {
                            ApplyOnce();
                        }
                    }
                }
                catch (Exception ex) {
                    error = true;
                    if (context.TransformAttribute != null)
                    {
                        Log.LogErrorFromException(XmlNodeException.Wrap(ex, context.TransformAttribute));
                    }
                    else
                    {
                        Log.LogErrorFromException(ex);
                    }
                }
                finally {
                    if (startedSection)
                    {
                        if (error)
                        {
                            Log.EndSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformErrorExecutingMessage, TransformNameShort);
                        }
                        else
                        {
                            Log.EndSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformEndExecutingMessage, TransformNameShort);
                        }
                    }
                    else
                    {
                        Log.LogMessage(MessageType.Normal, SR.XMLTRANSFORMATION_TransformNotExecutingMessage, TransformNameLong);
                    }

                    this.context        = null;
                    this.argumentString = null;
                    this.arguments      = null;

                    ReleaseLogger();
                }
            }
        }
Ejemplo n.º 3
0
 private Exception WrapException(Exception ex)
 {
     return(XmlNodeException.Wrap(ex, Element));
 }
Ejemplo n.º 4
0
 private Exception WrapException(Exception ex, XmlNodeContext context)
 {
     return(XmlNodeException.Wrap(ex, context.Node));
 }
Ejemplo n.º 5
0
 internal void Execute(XmlElementContext context, string argumentString)
 {
     if ((this.context == null) && (this.argumentString == null))
     {
         bool flag  = false;
         bool flag2 = false;
         try
         {
             this.context        = context;
             this.argumentString = argumentString;
             this.arguments      = null;
             if (this.ShouldExecuteTransform())
             {
                 flag2 = true;
                 object[] messageArgs = new object[] { this.TransformNameLong };
                 this.Log.StartSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformBeginExecutingMessage, messageArgs);
                 object[] objArray2 = new object[] { context.XPath };
                 this.Log.LogMessage(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformStatusXPath, objArray2);
                 if (this.ApplyTransformToAllTargetNodes)
                 {
                     this.ApplyOnAllTargetNodes();
                 }
                 else
                 {
                     this.ApplyOnce();
                 }
             }
         }
         catch (Exception exception)
         {
             flag = true;
             if (context.TransformAttribute != null)
             {
                 this.Log.LogErrorFromException(XmlNodeException.Wrap(exception, context.TransformAttribute));
             }
             else
             {
                 this.Log.LogErrorFromException(exception);
             }
         }
         finally
         {
             if (!flag2)
             {
                 object[] messageArgs = new object[] { this.TransformNameLong };
                 this.Log.LogMessage(MessageType.Normal, SR.XMLTRANSFORMATION_TransformNotExecutingMessage, messageArgs);
             }
             else if (flag)
             {
                 object[] messageArgs = new object[] { this.TransformNameShort };
                 this.Log.EndSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformErrorExecutingMessage, messageArgs);
             }
             else
             {
                 object[] messageArgs = new object[] { this.TransformNameShort };
                 this.Log.EndSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformEndExecutingMessage, messageArgs);
             }
             this.context        = null;
             this.argumentString = null;
             this.arguments      = null;
             this.ReleaseLogger();
         }
     }
 }
Ejemplo n.º 6
0
 private Exception WrapException(Exception ex, XmlNode node) =>
 XmlNodeException.Wrap(ex, node);
Ejemplo n.º 7
0
 private Exception WrapException(Exception ex) =>
 XmlNodeException.Wrap(ex, this.Element);
Ejemplo n.º 8
0
 private Exception WrapException(Exception ex, XmlNodeContext context) =>
 XmlNodeException.Wrap(ex, context.Node);