﻿// Decompiled with JetBrains decompiler
// Type: System.Data.TypedDataSetGeneratorException
// Assembly: System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: A0A8E655-5215-4802-816D-C9E5EBD7DA5D
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.dll

using System;
using System.Collections;
using System.Runtime.Serialization;
using System.Security.Permissions;

namespace System.Data
{
  /// <summary>
  /// The exception that is thrown when a name conflict occurs while generating a strongly typed <see cref="T:System.Data.DataSet"/>.
  /// </summary>
  /// <filterpriority>1</filterpriority>
  [Serializable]
  public class TypedDataSetGeneratorException : DataException
  {
    private string KEY_ARRAYCOUNT = "KEY_ARRAYCOUNT";
    private string KEY_ARRAYVALUES = "KEY_ARRAYVALUES";
    private ArrayList errorList;

    /// <summary>
    /// Gets a dynamic list of generated errors.
    /// </summary>
    /// 
    /// <returns>
    /// <see cref="T:System.Collections.ArrayList"/> object.
    /// </returns>
    /// <filterpriority>2</filterpriority>
    public ArrayList ErrorList
    {
      get
      {
        return this.errorList;
      }
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Data.TypedDataSetGeneratorException"/> class using the specified serialization information and streaming context.
    /// </summary>
    /// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo"/> object. </param><param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext"/> structure. </param>
    protected TypedDataSetGeneratorException(SerializationInfo info, StreamingContext context)
      : base(info, context)
    {
      int num = (int) info.GetValue(this.KEY_ARRAYCOUNT, typeof (int));
      if (num > 0)
      {
        this.errorList = new ArrayList();
        for (int index = 0; index < num; ++index)
          this.errorList.Add(info.GetValue(this.KEY_ARRAYVALUES + (object) index, typeof (string)));
      }
      else
        this.errorList = (ArrayList) null;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Data.TypedDataSetGeneratorException"/> class.
    /// </summary>
    public TypedDataSetGeneratorException()
    {
      this.errorList = (ArrayList) null;
      this.HResult = -2146232021;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Data.TypedDataSetGeneratorException"/> class with the specified string.
    /// </summary>
    /// <param name="message">The string to display when the exception is thrown.</param>
    public TypedDataSetGeneratorException(string message)
      : base(message)
    {
      this.HResult = -2146232021;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Data.TypedDataSetGeneratorException"/> class with the specified string and inner exception.
    /// </summary>
    /// <param name="message">The string to display when the exception is thrown.</param><param name="innerException">A reference to an inner exception.</param>
    public TypedDataSetGeneratorException(string message, Exception innerException)
      : base(message, innerException)
    {
      this.HResult = -2146232021;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Data.TypedDataSetGeneratorException"/> class.
    /// </summary>
    /// <param name="list"><see cref="T:System.Collections.ArrayList"/> object containing a dynamic list of exceptions. </param>
    public TypedDataSetGeneratorException(ArrayList list)
      : this()
    {
      this.errorList = list;
      this.HResult = -2146232021;
    }

    /// <summary>
    /// Implements the ISerializable interface and returns the data needed to serialize the <see cref="T:System.Data.TypedDataSetGeneratorException"/> object.
    /// </summary>
    /// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo"/> object. </param><param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext"/> structure. </param><filterpriority>2</filterpriority><PermissionSet><IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, SerializationFormatter"/></PermissionSet>
    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
    public override void GetObjectData(SerializationInfo info, StreamingContext context)
    {
      base.GetObjectData(info, context);
      if (this.errorList != null)
      {
        info.AddValue(this.KEY_ARRAYCOUNT, this.errorList.Count);
        for (int index = 0; index < this.errorList.Count; ++index)
          info.AddValue(this.KEY_ARRAYVALUES + (object) index, (object) this.errorList[index].ToString());
      }
      else
        info.AddValue(this.KEY_ARRAYCOUNT, 0);
    }
  }
}
