// Decompiled with JetBrains decompiler
// Type: Starksoft.Net.Proxy.ProxyClientFactory
// Assembly: svchost, Version=3.2.4.0, Culture=neutral, PublicKeyToken=null
// MVID: 8F51F928-E1DB-4815-857F-7D580385B815
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Backdoor.MSIL.IrcBot.lp-4dd7df88cffbf85a5894bc1b38660fa613c24b0e6c004ac00b2b119c03a35d3f.exe

using System;
using System.Net.Sockets;

namespace Starksoft.Net.Proxy
{
  public class ProxyClientFactory
  {
    public IProxyClient CreateProxyClient(ProxyType type)
    {
      switch (type)
      {
        case ProxyType.None:
          throw new ArgumentOutOfRangeException(nameof (type));
        case ProxyType.Http:
          return (IProxyClient) new HttpProxyClient();
        case ProxyType.Socks4:
          return (IProxyClient) new Socks4ProxyClient();
        case ProxyType.Socks4a:
          return (IProxyClient) new Socks4aProxyClient();
        case ProxyType.Socks5:
          return (IProxyClient) new Socks5ProxyClient();
        default:
          throw new ProxyException(string.Format("Unknown proxy type {0}.", (object) type.ToString()));
      }
    }

    public IProxyClient CreateProxyClient(ProxyType type, TcpClient tcpClient)
    {
      switch (type)
      {
        case ProxyType.None:
          throw new ArgumentOutOfRangeException(nameof (type));
        case ProxyType.Http:
          return (IProxyClient) new HttpProxyClient(tcpClient);
        case ProxyType.Socks4:
          return (IProxyClient) new Socks4ProxyClient(tcpClient);
        case ProxyType.Socks4a:
          return (IProxyClient) new Socks4aProxyClient(tcpClient);
        case ProxyType.Socks5:
          return (IProxyClient) new Socks5ProxyClient(tcpClient);
        default:
          throw new ProxyException(string.Format("Unknown proxy type {0}.", (object) type.ToString()));
      }
    }

    public IProxyClient CreateProxyClient(
      ProxyType type,
      string proxyHost,
      int proxyPort)
    {
      switch (type)
      {
        case ProxyType.None:
          throw new ArgumentOutOfRangeException(nameof (type));
        case ProxyType.Http:
          return (IProxyClient) new HttpProxyClient(proxyHost, proxyPort);
        case ProxyType.Socks4:
          return (IProxyClient) new Socks4ProxyClient(proxyHost, proxyPort);
        case ProxyType.Socks4a:
          return (IProxyClient) new Socks4aProxyClient(proxyHost, proxyPort);
        case ProxyType.Socks5:
          return (IProxyClient) new Socks5ProxyClient(proxyHost, proxyPort);
        default:
          throw new ProxyException(string.Format("Unknown proxy type {0}.", (object) type.ToString()));
      }
    }

    public IProxyClient CreateProxyClient(
      ProxyType type,
      string proxyHost,
      int proxyPort,
      string proxyUsername,
      string proxyPassword)
    {
      switch (type)
      {
        case ProxyType.None:
          throw new ArgumentOutOfRangeException(nameof (type));
        case ProxyType.Http:
          return (IProxyClient) new HttpProxyClient(proxyHost, proxyPort);
        case ProxyType.Socks4:
          return (IProxyClient) new Socks4ProxyClient(proxyHost, proxyPort, proxyUsername);
        case ProxyType.Socks4a:
          return (IProxyClient) new Socks4aProxyClient(proxyHost, proxyPort, proxyUsername);
        case ProxyType.Socks5:
          return (IProxyClient) new Socks5ProxyClient(proxyHost, proxyPort, proxyUsername, proxyPassword);
        default:
          throw new ProxyException(string.Format("Unknown proxy type {0}.", (object) type.ToString()));
      }
    }

    public IProxyClient CreateProxyClient(
      ProxyType type,
      TcpClient tcpClient,
      string proxyHost,
      int proxyPort,
      string proxyUsername,
      string proxyPassword)
    {
      IProxyClient proxyClient = this.CreateProxyClient(type, proxyHost, proxyPort, proxyUsername, proxyPassword);
      proxyClient.TcpClient = tcpClient;
      return proxyClient;
    }
  }
}
