﻿// Decompiled with JetBrains decompiler
// Type: System.Net.Configuration.SmtpSectionInternal
// Assembly: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 5ABD58FD-DF31-44FD-A492-63F2B47CC9AF
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll

using System.Configuration;
using System.Net.Mail;
using System.Runtime;
using System.Threading;

namespace System.Net.Configuration
{
  internal sealed class SmtpSectionInternal
  {
    private SmtpDeliveryMethod deliveryMethod;
    private SmtpDeliveryFormat deliveryFormat;
    private string from;
    private SmtpNetworkElementInternal network;
    private SmtpSpecifiedPickupDirectoryElementInternal specifiedPickupDirectory;
    private static object classSyncObject;

    internal SmtpDeliveryMethod DeliveryMethod
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.deliveryMethod;
      }
    }

    internal SmtpDeliveryFormat DeliveryFormat
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.deliveryFormat;
      }
    }

    internal SmtpNetworkElementInternal Network
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.network;
      }
    }

    internal string From
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.from;
      }
    }

    internal SmtpSpecifiedPickupDirectoryElementInternal SpecifiedPickupDirectory
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.specifiedPickupDirectory;
      }
    }

    internal static object ClassSyncObject
    {
      get
      {
        if (SmtpSectionInternal.classSyncObject == null)
          Interlocked.CompareExchange(ref SmtpSectionInternal.classSyncObject, new object(), (object) null);
        return SmtpSectionInternal.classSyncObject;
      }
    }

    internal SmtpSectionInternal(SmtpSection section)
    {
      this.deliveryMethod = section.DeliveryMethod;
      this.deliveryFormat = section.DeliveryFormat;
      this.from = section.From;
      this.network = new SmtpNetworkElementInternal(section.Network);
      this.specifiedPickupDirectory = new SmtpSpecifiedPickupDirectoryElementInternal(section.SpecifiedPickupDirectory);
    }

    internal static SmtpSectionInternal GetSection()
    {
      lock (SmtpSectionInternal.ClassSyncObject)
      {
        SmtpSection local_0 = PrivilegedConfigurationManager.GetSection(ConfigurationStrings.SmtpSectionPath) as SmtpSection;
        if (local_0 == null)
          return (SmtpSectionInternal) null;
        return new SmtpSectionInternal(local_0);
      }
    }
  }
}
