// Decompiled with JetBrains decompiler
// Type: FileCash_v3._0.Program
// Assembly: FileCash_v3.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 1DECC99D-34C5-4E02-A85D-DC744B5C555A
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Constructor.MSIL.ArchSMS.a-33cc8dceb24ed9df287e1f92d02773477af42b8d2b6de53a45bb9b5a3ead070b.exe

using CheckRunedCopy;
using FileCash_v3._0.Properties;
using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Windows.Forms;

namespace FileCash_v3._0
{
  internal static class Program
  {
    [STAThread]
    private static void Main()
    {
      if (!SingleInstance.IsFirstRun)
      {
        SingleInstance.ShowWindow("Form1");
      }
      else
      {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Program.AppDomain_AssemblyResolve);
        Application.Run((Form) new auth());
      }
    }

    private static Assembly AppDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
      if (args.Name.Contains("ZipForge"))
      {
        using (MemoryStream memoryStream = new MemoryStream(Resources.ZipForge_dll))
        {
          using (DeflateStream input = new DeflateStream((Stream) memoryStream, CompressionMode.Decompress))
          {
            using (BinaryReader binaryReader = new BinaryReader((Stream) input))
            {
              int count = 1048576;
              return Assembly.Load(binaryReader.ReadBytes(count));
            }
          }
        }
      }
      else
      {
        if (!args.Name.Contains("HtmlAgilityPack"))
          return (Assembly) null;
        using (MemoryStream input = new MemoryStream(Resources.HtmlAgilityPack))
        {
          using (BinaryReader binaryReader = new BinaryReader((Stream) input))
          {
            int count = 1048576;
            return Assembly.Load(binaryReader.ReadBytes(count));
          }
        }
      }
    }
  }
}
