// Decompiled with JetBrains decompiler
// Type: RansomGuard.RansomGuardConfig
// Assembly: RansomGuard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 37652FF6-4FF5-4E76-944D-E6CA5073036F
// Assembly location: RansomGuard.dll inside C:\Users\WDAGUtilityAccount\Desktop\RansomGuard.exe)

using \u003CPrivateImplementationDetails\u003E\u007B29195D03\u002D3E0A\u002D468D\u002DA5D2\u002D1BA9D027086D\u007D;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Windows.Forms;

#nullable enable
namespace RansomGuard;

public class RansomGuardConfig
{
  public FormWindowState? LastWindowState { get; [param: In] set; }

  public int? WindowWidth { get; [param: In] set; }

  public int? WindowHeight { get; [param: In] set; }

  public int? WindowLeft { get; [param: In] set; }

  public int? WindowTop { get; [param: In] set; }

  public double EntropyThreshold { get; [param: In] set; } = 9.7;

  public HashSet<string> IgnoredExtensions { get; [param: In] set; } = new HashSet<string>((IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);

  public HashSet<string> IgnoredDirectories { get; [param: In] set; } = new HashSet<string>((IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);

  public HashSet<string> WhitelistedProcesses { get; [param: In] set; } = new HashSet<string>((IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);

  [JsonConverter(typeof (JsonStringEnumConverter))]
  public DetectionPosture DetectionPosture { get; [param: In] set; } = DetectionPosture.Balanced;

  [JsonConverter(typeof (JsonStringEnumConverter))]
  public WiperSensitivity WiperSensitivity { get; [param: In] set; } = WiperSensitivity.Recommended;

  public int MinimumFiles { get; [param: In] set; } = 5;

  public int MinimumScore { get; [param: In] set; } = 10;

  public bool LockdownMode { get; [param: In] set; }

  public static RansomGuardConfig A([In] string obj0)
  {
    if (string.IsNullOrWhiteSpace(obj0))
      throw new ArgumentNullException(F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.Dq());
    if (!File.Exists(obj0))
      return new RansomGuardConfig();
    RansomGuardConfig ransomGuardConfig = JsonSerializer.Deserialize<RansomGuardConfig>(File.ReadAllText(obj0), new JsonSerializerOptions()
    {
      PropertyNameCaseInsensitive = true,
      ReadCommentHandling = JsonCommentHandling.Skip,
      AllowTrailingCommas = true
    }) ?? new RansomGuardConfig();
    ransomGuardConfig.A();
    return ransomGuardConfig;
  }

  public void a([In] string obj0)
  {
    if (string.IsNullOrWhiteSpace(obj0))
      throw new ArgumentNullException(F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.Dq());
    this.A();
    string directoryName = Path.GetDirectoryName(obj0);
    if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
      Directory.CreateDirectory(directoryName);
    string str1 = JsonSerializer.Serialize<RansomGuardConfig>(this, new JsonSerializerOptions()
    {
      WriteIndented = true
    });
    string str2 = obj0 + F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.bZ();
    File.WriteAllText(str2, str1, Encoding.UTF8);
    File.Move(str2, obj0, true);
  }

  public void A()
  {
    this.IgnoredExtensions = new HashSet<string>(Enumerable.Select<string, string>(Enumerable.Where<string>((IEnumerable<string>) this.IgnoredExtensions, (Func<string, bool>) (([In] obj0) => !string.IsNullOrWhiteSpace(obj0))), (Func<string, string>) (([In] obj0) =>
    {
      string lowerInvariant = obj0.Trim().ToLowerInvariant();
      return !lowerInvariant.StartsWith('.') ? F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.O() + lowerInvariant : lowerInvariant;
    })), (IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);
    this.IgnoredDirectories = new HashSet<string>(Enumerable.Select<string, string>(Enumerable.Where<string>((IEnumerable<string>) this.IgnoredDirectories, (Func<string, bool>) (([In] obj0) => !string.IsNullOrWhiteSpace(obj0))), (Func<string, string>) (([In] obj0) => RansomGuardConfig.c(RansomGuardConfig.C(obj0.Trim())).TrimEnd('\\') + F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.M())), (IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);
    this.WhitelistedProcesses = new HashSet<string>(Enumerable.Select<string, string>(Enumerable.Where<string>((IEnumerable<string>) this.WhitelistedProcesses, (Func<string, bool>) (([In] obj0) => !string.IsNullOrWhiteSpace(obj0))), (Func<string, string>) (([In] obj0) => obj0.Trim())), (IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);
    this.WhitelistedProcesses = new HashSet<string>(Enumerable.Select<string, string>(Enumerable.Where<string>((IEnumerable<string>) this.WhitelistedProcesses, (Func<string, bool>) (([In] obj0) => !string.IsNullOrWhiteSpace(obj0) && !obj0.Equals(F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.DO(), (StringComparison) 5) && !obj0.Equals(F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.m(), (StringComparison) 5) && obj0.Contains('\\') && obj0.Contains(':'))), (Func<string, string>) (([In] obj0) => obj0.Trim())), (IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);
  }

  public bool B([In] string obj0)
  {
    // ISSUE: object of a compiler-generated type is created
    // ISSUE: variable of a compiler-generated type
    RansomGuardConfig.a a = new RansomGuardConfig.a();
    if (string.IsNullOrWhiteSpace(obj0))
      return false;
    try
    {
      // ISSUE: reference to a compiler-generated field
      a.ea = Path.GetFullPath(obj0).TrimEnd('\\') + F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.M();
    }
    catch
    {
      return false;
    }
    // ISSUE: reference to a compiler-generated method
    return Enumerable.Any<string>((IEnumerable<string>) this.IgnoredDirectories, new Func<string, bool>(a.A));
  }

  public bool b([In] string obj0)
  {
    try
    {
      if (string.IsNullOrWhiteSpace(obj0))
        return false;
      if (!obj0.Contains(F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.M()) && !obj0.Contains(F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.DR()))
        return false;
      string str1;
      try
      {
        str1 = Path.GetFullPath(obj0).TrimEnd('\\');
      }
      catch
      {
        str1 = obj0.TrimEnd('\\');
      }
      foreach (string whitelistedProcess in this.WhitelistedProcesses)
      {
        if (!string.IsNullOrWhiteSpace(whitelistedProcess))
        {
          string str2 = whitelistedProcess.Trim();
          if (str2.EndsWith(F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.M()))
          {
            string str3 = str2.TrimEnd('\\') + F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.M();
            if (str1.StartsWith(str3, (StringComparison) 5))
              return true;
          }
          else if (string.Equals(str1, str2.TrimEnd('\\'), (StringComparison) 5))
            return true;
        }
      }
      return false;
    }
    catch
    {
      return false;
    }
  }

  private static string C([In] string obj0)
  {
    return string.IsNullOrWhiteSpace(obj0) ? obj0 : Environment.ExpandEnvironmentVariables(obj0);
  }

  private static string c([In] string obj0)
  {
    if (string.IsNullOrWhiteSpace(obj0))
      return obj0;
    try
    {
      return Path.GetFullPath(obj0);
    }
    catch
    {
    }
    return obj0.Replace(F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.p(), F5D1BF18\u002D5FBA\u002D43C1\u002DA4E0\u002D6D909C027158.M());
  }

  public bool EnableLolBinProtection { get; [param: In] set; } = true;

  public HashSet<string> LolBinAdditionalExecutables { get; [param: In] set; } = new HashSet<string>((IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);

  public HashSet<string> LolBinSafeParentExecutables { get; [param: In] set; } = new HashSet<string>((IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);

  [JsonPropertyName("VerboseLogging")]
  public bool VerboseLogging { get; [param: In] set; }

  [JsonPropertyName("StartWithWindows")]
  public bool StartWithWindows { get; [param: In] set; }
}
