コード例 #1
0
 internal static void Error(IDesignerSerializationManager manager, string exceptionText, string helpLink)
 {
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     if (exceptionText == null)
     {
         throw new ArgumentNullException("exceptionText");
     }
     CodeStatement statement = (CodeStatement) manager.Context[typeof(CodeStatement)];
     CodeLinePragma linePragma = null;
     if (statement != null)
     {
         linePragma = statement.LinePragma;
     }
     Exception exception = new CodeDomSerializerException(exceptionText, linePragma) {
         HelpLink = helpLink
     };
     throw exception;
 }
コード例 #2
0
 protected void DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
 {
     using (TraceScope("CodeDomSerializerBase::DeserializeStatement"))
     {
         manager.Context.Push(statement);
         try
         {
             CodeAssignStatement statement2 = statement as CodeAssignStatement;
             if (statement2 != null)
             {
                 this.DeserializeAssignStatement(manager, statement2);
             }
             else
             {
                 CodeVariableDeclarationStatement statement3 = statement as CodeVariableDeclarationStatement;
                 if (statement3 != null)
                 {
                     this.DeserializeVariableDeclarationStatement(manager, statement3);
                 }
                 else if (!(statement is CodeCommentStatement))
                 {
                     CodeExpressionStatement statement4 = statement as CodeExpressionStatement;
                     if (statement4 != null)
                     {
                         this.DeserializeExpression(manager, null, statement4.Expression);
                     }
                     else if (statement is CodeMethodReturnStatement)
                     {
                         this.DeserializeExpression(manager, null, statement4.Expression);
                     }
                     else
                     {
                         CodeAttachEventStatement statement6 = statement as CodeAttachEventStatement;
                         if (statement6 != null)
                         {
                             this.DeserializeAttachEventStatement(manager, statement6);
                         }
                         else
                         {
                             CodeRemoveEventStatement statement7 = statement as CodeRemoveEventStatement;
                             if (statement7 != null)
                             {
                                 this.DeserializeDetachEventStatement(manager, statement7);
                             }
                             else
                             {
                                 CodeLabeledStatement statement8 = statement as CodeLabeledStatement;
                                 if (statement8 != null)
                                 {
                                     this.DeserializeStatement(manager, statement8.Statement);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         catch (CheckoutException)
         {
             throw;
         }
         catch (Exception innerException)
         {
             if (innerException is TargetInvocationException)
             {
                 innerException = innerException.InnerException;
             }
             if (!(innerException is CodeDomSerializerException) && (statement.LinePragma != null))
             {
                 innerException = new CodeDomSerializerException(innerException, statement.LinePragma);
             }
             manager.ReportError(innerException);
         }
         finally
         {
             manager.Context.Pop();
         }
     }
 }