// Decompiled with JetBrains decompiler
// Type: Office_2010_Toolkit.Configuration.Settings
// Assembly: AutoKMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: D1CED9E3-1FC7-49B8-B3AC-44976AB7F6E4
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\HackTool.Win32.KMSAuto.i-f317ba4d4051fad64a0aa45b587fa3dcea795bac30acec2872779abe31a07cbe.exe

using System;
using System.IO;
using TaskScheduler;

namespace Office_2010_Toolkit.Configuration
{
  public static class Settings
  {
    public static bool ReadOnlyFolder;
    public static bool ReadOnlyFile;
    public static bool INIExists;
    public static SettingsIDObject SettingsID = new SettingsIDObject();
    public static GlobalSettingsObject GlobalSettings = new GlobalSettingsObject();
    public static AutoKMSSettingsObject AutoKMSSettings = new AutoKMSSettingsObject();
    public static AutoRearmSettingsObject AutoRearmSettings = new AutoRearmSettingsObject();
    public static EZActivatorSettingsObject EZActivatorSettings = new EZActivatorSettingsObject();
    public static PathsSettingsObject PathsSettings = new PathsSettingsObject();

    public static string GetAutoKMSPath()
    {
      string empty = string.Empty;
      string autoKmsPath;
      if (Common.IsAutoKMSInstalled())
      {
        ScheduledTasks scheduledTasks = new ScheduledTasks();
        try
        {
          Task task = scheduledTasks.OpenTask("AutoKMS");
          autoKmsPath = task.ApplicationName.Substring(0, task.ApplicationName.Length - 12);
          task.Close();
          scheduledTasks.Dispose();
        }
        catch (Exception ex)
        {
          Task task = scheduledTasks.OpenTask("AutoKMSCustom");
          autoKmsPath = task.ApplicationName.Substring(0, task.ApplicationName.Length - 12);
          task.Close();
          scheduledTasks.Dispose();
        }
      }
      else
        autoKmsPath = Settings.PathsSettings.AutoKMS;
      return autoKmsPath;
    }

    public static string GetAutoRearmPath()
    {
      string empty = string.Empty;
      string autoRearmPath;
      if (Common.IsAutoRearmInstalled())
      {
        ScheduledTasks scheduledTasks = new ScheduledTasks();
        try
        {
          Task task = scheduledTasks.OpenTask("AutoRearm");
          autoRearmPath = task.ApplicationName.Substring(0, task.ApplicationName.Length - 14);
          task.Close();
          scheduledTasks.Dispose();
        }
        catch (Exception ex)
        {
          Task task = scheduledTasks.OpenTask("AutoRearmCustom");
          autoRearmPath = task.ApplicationName.Substring(0, task.ApplicationName.Length - 14);
          task.Close();
          scheduledTasks.Dispose();
        }
      }
      else
        autoRearmPath = Settings.PathsSettings.AutoRearm;
      return autoRearmPath;
    }

    public static void GetSettings()
    {
      Settings.HandleReadOnly();
      if (Settings.ReadOnlyFolder)
      {
        if (Settings.INIExists)
        {
          Settings.LoadINISettings();
        }
        else
        {
          Settings.SettingsID = new SettingsIDObject();
          Settings.GlobalSettings = new GlobalSettingsObject();
          Settings.AutoKMSSettings = new AutoKMSSettingsObject();
          Settings.AutoRearmSettings = new AutoRearmSettingsObject();
          Settings.EZActivatorSettings = new EZActivatorSettingsObject();
          Settings.PathsSettings = new PathsSettingsObject();
        }
      }
      else if (Settings.INIExists)
        Settings.LoadINISettings();
      else
        Settings.MakeDefaultToolkitINIFile();
    }

    public static void GetSettingsAutoKMS()
    {
      if (!new FileInfo(Settings.GetAutoKMSPath() + "\\AutoKMS.ini").Exists)
        Settings.MakeDefaultAutoKMSINIFile();
      Settings.LoadINISettingsAutoKMS();
    }

    public static void GetSettingsAutoRearm()
    {
      if (!new FileInfo(Settings.GetAutoRearmPath() + "\\AutoRearm.ini").Exists)
        Settings.MakeDefaultAutoRearmINIFile();
      Settings.LoadINISettingsAutoRearm();
    }

    public static void MakeDefaultToolkitINIFile()
    {
      Settings.SettingsID = new SettingsIDObject();
      Settings.GlobalSettings = new GlobalSettingsObject();
      Settings.AutoKMSSettings = new AutoKMSSettingsObject();
      Settings.AutoRearmSettings = new AutoRearmSettingsObject();
      Settings.EZActivatorSettings = new EZActivatorSettingsObject();
      Settings.PathsSettings = new PathsSettingsObject();
      string str = Directory.GetCurrentDirectory() + "\\Settings.ini";
      FileInfo fileInfo = new FileInfo(str);
      if (fileInfo.Exists)
        fileInfo.Delete();
      IniFile iniFile = new IniFile(str);
      iniFile.IniWriteValue("SettingsID", "ID", Settings.SettingsID.ID);
      iniFile.IniWriteValue("Global", "AutoRemoveKMSEmulator", Settings.GlobalSettings.AutoRemoveKMSEmulator.ToString());
      iniFile.IniWriteValue("Global", "AutoRemoveKMSHost", Settings.GlobalSettings.AutoRemoveKMSHost.ToString());
      iniFile.IniWriteValue("Global", "KMSServer", Settings.GlobalSettings.KMSServer.ToString());
      iniFile.IniWriteValue("Global", "UseKMSEmulator", Settings.GlobalSettings.UseKMSEmulator.ToString());
      iniFile.IniWriteValue("Global", "VerboseCheckActivation", Settings.GlobalSettings.VerboseCheckActivation.ToString());
      iniFile.IniWriteValue("Global", "ShowCMID", Settings.GlobalSettings.ShowCMID.ToString());
      iniFile.IniWriteValue("Global", "KMSPID", Settings.GlobalSettings.KMSPID.ToString());
      iniFile.IniWriteValue("AutoKMS", "ActAttempts", Settings.AutoKMSSettings.ActAttempts.ToString());
      iniFile.IniWriteValue("AutoKMS", "ActivateWindows", Settings.AutoKMSSettings.ActivateWindows.ToString());
      iniFile.IniWriteValue("AutoKMS", "AutoRemoveKMSEmulator", Settings.AutoKMSSettings.AutoRemoveKMSEmulator.ToString());
      iniFile.IniWriteValue("AutoKMS", "AutoRemoveKMSHost", Settings.AutoKMSSettings.AutoRemoveKMSHost.ToString());
      iniFile.IniWriteValue("AutoKMS", "KMSServer", Settings.AutoKMSSettings.KMSServer.ToString());
      iniFile.IniWriteValue("AutoKMS", "Logging", Settings.AutoKMSSettings.Logging.ToString());
      iniFile.IniWriteValue("AutoKMS", "UseKMSEmulator", Settings.AutoKMSSettings.UseKMSEmulator.ToString());
      iniFile.IniWriteValue("AutoKMS", "KMSPID", Settings.AutoKMSSettings.KMSPID.ToString());
      iniFile.IniWriteValue("AutoRearm", "Retail2VL", Settings.AutoRearmSettings.Retail2VL.ToString());
      iniFile.IniWriteValue("AutoRearm", "Logging", Settings.AutoRearmSettings.Logging.ToString());
      iniFile.IniWriteValue("EZ-Activator", "ActAttempts", Settings.EZActivatorSettings.ActAttempts.ToString());
      iniFile.IniWriteValue("EZ-Activator", "PIDAttempts", Settings.EZActivatorSettings.PIDAttempts.ToString());
      iniFile.IniWriteValue("EZ-Activator", "CMIDAttempts", Settings.EZActivatorSettings.CMIDAttempts.ToString());
      iniFile.IniWriteValue("EZ-Activator", "AutoLicRepairAll", Settings.EZActivatorSettings.AutoLicRepairAll.ToString());
      iniFile.IniWriteValue("EZ-Activator", "AutoMakeRestoreBackup", Settings.EZActivatorSettings.AutoMakeRestoreBackup.ToString());
      iniFile.IniWriteValue("EZ-Activator", "ChangePID", Settings.EZActivatorSettings.ChangePID.ToString());
      iniFile.IniWriteValue("EZ-Activator", "ChangeCMID", Settings.EZActivatorSettings.ChangeCMID.ToString());
      iniFile.IniWriteValue("EZ-Activator", "InstallAutoKMS", Settings.EZActivatorSettings.InstallAutoKMS.ToString());
      iniFile.IniWriteValue("EZ-Activator", "MAK2KMS", Settings.EZActivatorSettings.MAK2KMS.ToString());
      iniFile.IniWriteValue("EZ-Activator", "RemoveRetailKeys", Settings.EZActivatorSettings.RemoveRetailKeys.ToString());
      iniFile.IniWriteValue("EZ-Activator", "Retail2VL", Settings.EZActivatorSettings.Retail2VL.ToString());
      iniFile.IniWriteValue("EZ-Activator", "StarterSub2Bypass", Settings.EZActivatorSettings.StarterSub2Bypass.ToString());
      iniFile.IniWriteValue("Paths", "AutoKMS", Settings.PathsSettings.AutoKMS.ToString());
      iniFile.IniWriteValue("Paths", "AutoRearm", Settings.PathsSettings.AutoRearm.ToString());
      iniFile.IniWriteValue("Paths", "KMSEmulator", Settings.PathsSettings.KMSEmulator.ToString());
    }

    public static void MakeDefaultAutoKMSINIFile()
    {
      Settings.SettingsID = new SettingsIDObject();
      Settings.AutoKMSSettings = new AutoKMSSettingsObject();
      Settings.PathsSettings = new PathsSettingsObject();
      string str = Settings.GetAutoKMSPath() + "\\AutoKMS.ini";
      FileInfo fileInfo = new FileInfo(str);
      if (fileInfo.Exists)
        fileInfo.Delete();
      IniFile iniFile = new IniFile(str);
      iniFile.IniWriteValue("SettingsID", "ID", Settings.SettingsID.ID);
      iniFile.IniWriteValue("AutoKMS", "ActAttempts", Settings.AutoKMSSettings.ActAttempts.ToString());
      iniFile.IniWriteValue("AutoKMS", "ActivateWindows", Settings.AutoKMSSettings.ActivateWindows.ToString());
      iniFile.IniWriteValue("AutoKMS", "AutoRemoveKMSEmulator", Settings.AutoKMSSettings.AutoRemoveKMSEmulator.ToString());
      iniFile.IniWriteValue("AutoKMS", "AutoRemoveKMSHost", Settings.AutoKMSSettings.AutoRemoveKMSHost.ToString());
      iniFile.IniWriteValue("AutoKMS", "KMSServer", Settings.AutoKMSSettings.KMSServer.ToString());
      iniFile.IniWriteValue("AutoKMS", "Logging", Settings.AutoKMSSettings.Logging.ToString());
      iniFile.IniWriteValue("AutoKMS", "UseKMSEmulator", Settings.AutoKMSSettings.UseKMSEmulator.ToString());
      iniFile.IniWriteValue("AutoKMS", "KMSPID", Settings.AutoKMSSettings.KMSPID.ToString());
      iniFile.IniWriteValue("Paths", "AutoKMS", Settings.PathsSettings.AutoKMS.ToString());
      iniFile.IniWriteValue("Paths", "AutoRearm", Settings.PathsSettings.AutoRearm.ToString());
      iniFile.IniWriteValue("Paths", "KMSEmulator", Settings.PathsSettings.KMSEmulator.ToString());
    }

    public static void MakeDefaultAutoRearmINIFile()
    {
      Settings.SettingsID = new SettingsIDObject();
      Settings.AutoRearmSettings = new AutoRearmSettingsObject();
      Settings.PathsSettings = new PathsSettingsObject();
      string str = Settings.GetAutoRearmPath() + "\\AutoRearm.ini";
      FileInfo fileInfo = new FileInfo(str);
      if (fileInfo.Exists)
        fileInfo.Delete();
      IniFile iniFile = new IniFile(str);
      iniFile.IniWriteValue("SettingsID", "ID", Settings.SettingsID.ID);
      iniFile.IniWriteValue("AutoRearm", "Retail2VL", Settings.AutoRearmSettings.Retail2VL.ToString());
      iniFile.IniWriteValue("AutoRearm", "Logging", Settings.AutoRearmSettings.Logging.ToString());
      iniFile.IniWriteValue("Paths", "AutoKMS", Settings.PathsSettings.AutoKMS.ToString());
      iniFile.IniWriteValue("Paths", "AutoRearm", Settings.PathsSettings.AutoRearm.ToString());
      iniFile.IniWriteValue("Paths", "KMSEmulator", Settings.PathsSettings.KMSEmulator.ToString());
    }

    public static void MakeNewToolkitINIFile()
    {
      string str = Directory.GetCurrentDirectory() + "\\Settings.ini";
      FileInfo fileInfo = new FileInfo(str);
      if (fileInfo.Exists)
        fileInfo.Delete();
      IniFile iniFile = new IniFile(str);
      iniFile.IniWriteValue("SettingsID", "ID", Settings.SettingsID.ID);
      iniFile.IniWriteValue("Global", "AutoRemoveKMSEmulator", Settings.GlobalSettings.AutoRemoveKMSEmulator.ToString());
      iniFile.IniWriteValue("Global", "AutoRemoveKMSHost", Settings.GlobalSettings.AutoRemoveKMSHost.ToString());
      iniFile.IniWriteValue("Global", "KMSServer", Settings.GlobalSettings.KMSServer.ToString());
      iniFile.IniWriteValue("Global", "UseKMSEmulator", Settings.GlobalSettings.UseKMSEmulator.ToString());
      iniFile.IniWriteValue("Global", "VerboseCheckActivation", Settings.GlobalSettings.VerboseCheckActivation.ToString());
      iniFile.IniWriteValue("Global", "ShowCMID", Settings.GlobalSettings.ShowCMID.ToString());
      iniFile.IniWriteValue("Global", "KMSPID", Settings.GlobalSettings.KMSPID.ToString());
      iniFile.IniWriteValue("AutoKMS", "ActAttempts", Settings.AutoKMSSettings.ActAttempts.ToString());
      iniFile.IniWriteValue("AutoKMS", "ActivateWindows", Settings.AutoKMSSettings.ActivateWindows.ToString());
      iniFile.IniWriteValue("AutoKMS", "AutoRemoveKMSEmulator", Settings.AutoKMSSettings.AutoRemoveKMSEmulator.ToString());
      iniFile.IniWriteValue("AutoKMS", "AutoRemoveKMSHost", Settings.AutoKMSSettings.AutoRemoveKMSHost.ToString());
      iniFile.IniWriteValue("AutoKMS", "KMSServer", Settings.AutoKMSSettings.KMSServer.ToString());
      iniFile.IniWriteValue("AutoKMS", "Logging", Settings.AutoKMSSettings.Logging.ToString());
      iniFile.IniWriteValue("AutoKMS", "UseKMSEmulator", Settings.AutoKMSSettings.UseKMSEmulator.ToString());
      iniFile.IniWriteValue("AutoKMS", "KMSPID", Settings.AutoKMSSettings.KMSPID.ToString());
      iniFile.IniWriteValue("AutoRearm", "Retail2VL", Settings.AutoRearmSettings.Retail2VL.ToString());
      iniFile.IniWriteValue("AutoRearm", "Logging", Settings.AutoRearmSettings.Logging.ToString());
      iniFile.IniWriteValue("EZ-Activator", "ActAttempts", Settings.EZActivatorSettings.ActAttempts.ToString());
      iniFile.IniWriteValue("EZ-Activator", "PIDAttempts", Settings.EZActivatorSettings.PIDAttempts.ToString());
      iniFile.IniWriteValue("EZ-Activator", "CMIDAttempts", Settings.EZActivatorSettings.CMIDAttempts.ToString());
      iniFile.IniWriteValue("EZ-Activator", "AutoLicRepairAll", Settings.EZActivatorSettings.AutoLicRepairAll.ToString());
      iniFile.IniWriteValue("EZ-Activator", "AutoMakeRestoreBackup", Settings.EZActivatorSettings.AutoMakeRestoreBackup.ToString());
      iniFile.IniWriteValue("EZ-Activator", "ChangePID", Settings.EZActivatorSettings.ChangePID.ToString());
      iniFile.IniWriteValue("EZ-Activator", "ChangeCMID", Settings.EZActivatorSettings.ChangeCMID.ToString());
      iniFile.IniWriteValue("EZ-Activator", "InstallAutoKMS", Settings.EZActivatorSettings.InstallAutoKMS.ToString());
      iniFile.IniWriteValue("EZ-Activator", "MAK2KMS", Settings.EZActivatorSettings.MAK2KMS.ToString());
      iniFile.IniWriteValue("EZ-Activator", "RemoveRetailKeys", Settings.EZActivatorSettings.RemoveRetailKeys.ToString());
      iniFile.IniWriteValue("EZ-Activator", "Retail2VL", Settings.EZActivatorSettings.Retail2VL.ToString());
      iniFile.IniWriteValue("EZ-Activator", "StarterSub2Bypass", Settings.EZActivatorSettings.StarterSub2Bypass.ToString());
      iniFile.IniWriteValue("Paths", "AutoKMS", Settings.PathsSettings.AutoKMS.ToString());
      iniFile.IniWriteValue("Paths", "AutoRearm", Settings.PathsSettings.AutoRearm.ToString());
      iniFile.IniWriteValue("Paths", "KMSEmulator", Settings.PathsSettings.KMSEmulator.ToString());
    }

    public static void MakeNewAutoKMSINIFile()
    {
      string str = Settings.GetAutoKMSPath() + "\\AutoKMS.ini";
      FileInfo fileInfo = new FileInfo(str);
      if (fileInfo.Exists)
        fileInfo.Delete();
      IniFile iniFile = new IniFile(str);
      iniFile.IniWriteValue("SettingsID", "ID", Settings.SettingsID.ID);
      iniFile.IniWriteValue("AutoKMS", "ActAttempts", Settings.AutoKMSSettings.ActAttempts.ToString());
      iniFile.IniWriteValue("AutoKMS", "ActivateWindows", Settings.AutoKMSSettings.ActivateWindows.ToString());
      iniFile.IniWriteValue("AutoKMS", "AutoRemoveKMSEmulator", Settings.AutoKMSSettings.AutoRemoveKMSEmulator.ToString());
      iniFile.IniWriteValue("AutoKMS", "AutoRemoveKMSHost", Settings.AutoKMSSettings.AutoRemoveKMSHost.ToString());
      iniFile.IniWriteValue("AutoKMS", "KMSServer", Settings.AutoKMSSettings.KMSServer.ToString());
      iniFile.IniWriteValue("AutoKMS", "Logging", Settings.AutoKMSSettings.Logging.ToString());
      iniFile.IniWriteValue("AutoKMS", "UseKMSEmulator", Settings.AutoKMSSettings.UseKMSEmulator.ToString());
      iniFile.IniWriteValue("AutoKMS", "KMSPID", Settings.AutoKMSSettings.KMSPID.ToString());
      iniFile.IniWriteValue("Paths", "AutoKMS", Settings.PathsSettings.AutoKMS.ToString());
      iniFile.IniWriteValue("Paths", "AutoRearm", Settings.PathsSettings.AutoRearm.ToString());
      iniFile.IniWriteValue("Paths", "KMSEmulator", Settings.PathsSettings.KMSEmulator.ToString());
    }

    public static void MakeNewAutoRearmINIFile()
    {
      string str = Settings.GetAutoRearmPath() + "\\AutoRearm.ini";
      FileInfo fileInfo = new FileInfo(str);
      if (fileInfo.Exists)
        fileInfo.Delete();
      IniFile iniFile = new IniFile(str);
      iniFile.IniWriteValue("SettingsID", "ID", Settings.SettingsID.ID);
      iniFile.IniWriteValue("AutoRearm", "Retail2VL", Settings.AutoRearmSettings.Retail2VL.ToString());
      iniFile.IniWriteValue("AutoRearm", "Logging", Settings.AutoRearmSettings.Logging.ToString());
      iniFile.IniWriteValue("Paths", "AutoKMS", Settings.PathsSettings.AutoKMS.ToString());
      iniFile.IniWriteValue("Paths", "AutoRearm", Settings.PathsSettings.AutoRearm.ToString());
      iniFile.IniWriteValue("Paths", "KMSEmulator", Settings.PathsSettings.KMSEmulator.ToString());
    }

    public static void LoadINISettings()
    {
      string str = Directory.GetCurrentDirectory() + "\\Settings.ini";
      FileInfo fileInfo = new FileInfo(str);
      IniFile iniFile = new IniFile(str);
      string id = Settings.SettingsID.ID;
      if (iniFile.IniReadValue("SettingsID", "ID") == id)
      {
        Settings.GlobalSettings.AutoRemoveKMSEmulator = Convert.ToBoolean(iniFile.IniReadValue("Global", "AutoRemoveKMSEmulator").ToLower());
        Settings.GlobalSettings.AutoRemoveKMSHost = Convert.ToBoolean(iniFile.IniReadValue("Global", "AutoRemoveKMSHost").ToLower());
        Settings.GlobalSettings.KMSServer = iniFile.IniReadValue("Global", "KMSServer");
        Settings.GlobalSettings.UseKMSEmulator = Convert.ToBoolean(iniFile.IniReadValue("Global", "UseKMSEmulator").ToLower());
        Settings.GlobalSettings.VerboseCheckActivation = Convert.ToBoolean(iniFile.IniReadValue("Global", "VerboseCheckActivation").ToLower());
        Settings.GlobalSettings.ShowCMID = Convert.ToBoolean(iniFile.IniReadValue("Global", "ShowCMID").ToLower());
        Settings.GlobalSettings.KMSPID = iniFile.IniReadValue("Global", "KMSPID");
        Settings.AutoKMSSettings.ActAttempts = Convert.ToInt32(iniFile.IniReadValue("AutoKMS", "ActAttempts"));
        Settings.AutoKMSSettings.ActivateWindows = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "ActivateWindows"));
        Settings.AutoKMSSettings.AutoRemoveKMSEmulator = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "AutoRemoveKMSEmulator").ToLower());
        Settings.AutoKMSSettings.AutoRemoveKMSHost = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "AutoRemoveKMSHost").ToLower());
        Settings.AutoKMSSettings.KMSServer = iniFile.IniReadValue("AutoKMS", "KMSServer");
        Settings.AutoKMSSettings.Logging = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "Logging").ToLower());
        Settings.AutoKMSSettings.UseKMSEmulator = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "UseKMSEmulator").ToLower());
        Settings.AutoKMSSettings.KMSPID = iniFile.IniReadValue("AutoKMS", "KMSPID");
        Settings.AutoRearmSettings.Retail2VL = Convert.ToBoolean(iniFile.IniReadValue("AutoRearm", "Retail2VL").ToLower());
        Settings.AutoRearmSettings.Logging = Convert.ToBoolean(iniFile.IniReadValue("AutoRearm", "Logging").ToLower());
        Settings.EZActivatorSettings.ActAttempts = Convert.ToInt32(iniFile.IniReadValue("EZ-Activator", "ActAttempts"));
        Settings.EZActivatorSettings.PIDAttempts = Convert.ToInt32(iniFile.IniReadValue("EZ-Activator", "PIDAttempts"));
        Settings.EZActivatorSettings.CMIDAttempts = Convert.ToInt32(iniFile.IniReadValue("EZ-Activator", "CMIDAttempts"));
        Settings.EZActivatorSettings.ChangePID = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "ChangePID").ToLower());
        Settings.EZActivatorSettings.ChangeCMID = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "ChangeCMID").ToLower());
        Settings.EZActivatorSettings.AutoLicRepairAll = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "AutoLicRepairAll").ToLower());
        Settings.EZActivatorSettings.AutoMakeRestoreBackup = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "AutoMakeRestoreBackup").ToLower());
        Settings.EZActivatorSettings.InstallAutoKMS = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "InstallAutoKMS").ToLower());
        Settings.EZActivatorSettings.MAK2KMS = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "MAK2KMS").ToLower());
        Settings.EZActivatorSettings.RemoveRetailKeys = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "RemoveRetailKeys").ToLower());
        Settings.EZActivatorSettings.Retail2VL = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "Retail2VL").ToLower());
        Settings.EZActivatorSettings.StarterSub2Bypass = Convert.ToBoolean(iniFile.IniReadValue("EZ-Activator", "StarterSub2Bypass").ToLower());
        Settings.PathsSettings.AutoKMS = Convert.ToString(iniFile.IniReadValue("Paths", "AutoKMS"));
        Settings.PathsSettings.AutoRearm = Convert.ToString(iniFile.IniReadValue("Paths", "AutoRearm"));
        Settings.PathsSettings.KMSEmulator = Convert.ToString(iniFile.IniReadValue("Paths", "KMSEmulator"));
      }
      else
      {
        Settings.MakeDefaultToolkitINIFile();
        Settings.LoadINISettings();
      }
    }

    public static void LoadINISettingsAutoKMS()
    {
      string str = Settings.GetAutoKMSPath() + "\\AutoKMS.ini";
      FileInfo fileInfo = new FileInfo(str);
      IniFile iniFile = new IniFile(str);
      string id = Settings.SettingsID.ID;
      if (iniFile.IniReadValue("SettingsID", "ID") == id)
      {
        Settings.AutoKMSSettings.ActAttempts = Convert.ToInt32(iniFile.IniReadValue("AutoKMS", "ActAttempts"));
        Settings.AutoKMSSettings.ActivateWindows = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "ActivateWindows").ToLower());
        Settings.AutoKMSSettings.AutoRemoveKMSEmulator = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "AutoRemoveKMSEmulator").ToLower());
        Settings.AutoKMSSettings.AutoRemoveKMSHost = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "AutoRemoveKMSHost").ToLower());
        Settings.AutoKMSSettings.KMSServer = iniFile.IniReadValue("AutoKMS", "KMSServer");
        Settings.AutoKMSSettings.Logging = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "Logging").ToLower());
        Settings.AutoKMSSettings.UseKMSEmulator = Convert.ToBoolean(iniFile.IniReadValue("AutoKMS", "UseKMSEmulator").ToLower());
        Settings.AutoKMSSettings.KMSPID = iniFile.IniReadValue("AutoKMS", "KMSPID");
        Settings.PathsSettings.AutoKMS = Convert.ToString(iniFile.IniReadValue("Paths", "AutoKMS"));
        Settings.PathsSettings.AutoRearm = Convert.ToString(iniFile.IniReadValue("Paths", "AutoRearm"));
        Settings.PathsSettings.KMSEmulator = Convert.ToString(iniFile.IniReadValue("Paths", "KMSEmulator"));
      }
      else
      {
        Settings.MakeDefaultAutoKMSINIFile();
        Settings.LoadINISettingsAutoKMS();
      }
    }

    public static void LoadINISettingsAutoRearm()
    {
      string str = Settings.GetAutoRearmPath() + "\\AutoRearm.ini";
      FileInfo fileInfo = new FileInfo(str);
      IniFile iniFile = new IniFile(str);
      string id = Settings.SettingsID.ID;
      if (iniFile.IniReadValue("SettingsID", "ID") == id)
      {
        Settings.AutoRearmSettings.Retail2VL = Convert.ToBoolean(iniFile.IniReadValue("AutoRearm", "Retail2VL"));
        Settings.AutoRearmSettings.Logging = Convert.ToBoolean(iniFile.IniReadValue("AutoRearm", "Logging").ToLower());
        Settings.PathsSettings.AutoKMS = Convert.ToString(iniFile.IniReadValue("Paths", "AutoKMS"));
        Settings.PathsSettings.AutoRearm = Convert.ToString(iniFile.IniReadValue("Paths", "AutoRearm"));
        Settings.PathsSettings.KMSEmulator = Convert.ToString(iniFile.IniReadValue("Paths", "KMSEmulator"));
      }
      else
      {
        Settings.MakeDefaultAutoRearmINIFile();
        Settings.LoadINISettingsAutoRearm();
      }
    }

    public static void HandleReadOnly()
    {
      string str = Directory.GetCurrentDirectory() + "\\Settings.ini";
      FileInfo fileInfo = new FileInfo(str);
      if (fileInfo.Exists)
      {
        Settings.INIExists = true;
        if (!fileInfo.IsReadOnly)
          return;
        Settings.ReadOnlyFile = true;
      }
      else
      {
        Settings.INIExists = false;
        try
        {
          File.Create(str).Dispose();
        }
        catch (UnauthorizedAccessException ex)
        {
          Settings.ReadOnlyFolder = true;
          Settings.ReadOnlyFile = true;
        }
        catch (Exception ex)
        {
          Settings.ReadOnlyFolder = true;
          Settings.ReadOnlyFile = true;
        }
      }
    }
  }
}
