juliavdkris

Decompiled main program

Apr 12th, 2020
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 181.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data.SQLite;
  5. using System.Diagnostics;
  6. using System.Drawing;
  7. using System.Globalization;
  8. using System.IO;
  9. using System.IO.Pipes;
  10. using System.Linq;
  11. using System.Management;
  12. using System.Net;
  13. using System.Reflection;
  14. using System.Runtime.CompilerServices;
  15. using System.Runtime.InteropServices;
  16. using System.Text.RegularExpressions;
  17. using System.Threading.Tasks;
  18. using System.Windows.Forms;
  19. using Microsoft.VisualBasic;
  20. using Microsoft.VisualBasic.CompilerServices;
  21. using Newtonsoft.Json;
  22. using Newtonsoft.Json.Linq;
  23. using SHDocVw;
  24.  
  25. namespace Cold_Turkey
  26. {
  27.     [DesignerGenerated]
  28.     public class ColdTurkey : Form
  29.     {
  30.         [DllImport("wininet.dll", CharSet = CharSet.Auto)]
  31.         private static extern bool InternetGetConnectedState(ref int Description, int ReservedValue);
  32.  
  33.         [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
  34.         private static extern bool AttachConsole(int dwProcessId);
  35.  
  36.         [DllImport("gdi32.dll")]
  37.         private static extern int GetDeviceCaps(IntPtr hdc, ColdTurkey.DeviceCap nIndex);
  38.  
  39.         private float GetScalingFactors()
  40.         {
  41.             IntPtr hdc = Graphics.FromHwnd(IntPtr.Zero).GetHdc();
  42.             int deviceCaps = ColdTurkey.GetDeviceCaps(hdc, ColdTurkey.DeviceCap.VERTRES);
  43.             int deviceCaps2 = ColdTurkey.GetDeviceCaps(hdc, ColdTurkey.DeviceCap.DESKTOPVERTRES);
  44.             float deviceCaps3 = (float)ColdTurkey.GetDeviceCaps(hdc, ColdTurkey.DeviceCap.LOGPIXELSY);
  45.             float num = (float)deviceCaps2 / (float)deviceCaps;
  46.             float num2 = deviceCaps3 / 96f;
  47.             float result;
  48.             if (num != 1f)
  49.             {
  50.                 result = num;
  51.             }
  52.             else
  53.             {
  54.                 result = num2;
  55.             }
  56.             return result;
  57.         }
  58.  
  59.         private void AdjustDPI()
  60.         {
  61.             try
  62.             {
  63.                 float scalingFactors = this.GetScalingFactors();
  64.                 if (scalingFactors == 1f)
  65.                 {
  66.                     this.webBrowserScale = 100;
  67.                 }
  68.                 else if (scalingFactors == 1.25f)
  69.                 {
  70.                     this.webBrowserScale = 150;
  71.                 }
  72.                 else if (scalingFactors == 1.5f)
  73.                 {
  74.                     this.webBrowserScale = 200;
  75.                 }
  76.                 else if (scalingFactors == 1.75f)
  77.                 {
  78.                     this.webBrowserScale = 250;
  79.                 }
  80.                 else if (scalingFactors == 2f)
  81.                 {
  82.                     this.webBrowserScale = 300;
  83.                 }
  84.                 else if (scalingFactors == 2.25f)
  85.                 {
  86.                     this.webBrowserScale = 350;
  87.                 }
  88.                 else if (scalingFactors == 2.5f)
  89.                 {
  90.                     this.webBrowserScale = 400;
  91.                 }
  92.                 else
  93.                 {
  94.                     this.webBrowserScale = 100;
  95.                 }
  96.             }
  97.             catch (Exception ex)
  98.             {
  99.             }
  100.         }
  101.  
  102.         private void ColdTurkey_Load(object sender, EventArgs e)
  103.         {
  104.             this.AdjustDPI();
  105.             this.OpenDatabases();
  106.             this.LoadSettings();
  107.             this.HandleCommandLineArguments(Environment.GetCommandLineArgs(), false);
  108.             this.SetAdditionalUpdate();
  109.             this.SetAdditionalWin10();
  110.             this.SetAdditionalUsers();
  111.             this.SetWindowTitle();
  112.             this.CalculateAllowances();
  113.             this.calculateAllowancesTimer.Start();
  114.             this.web.ScriptErrorsSuppressed = true;
  115.             this.web.ObjectForScripting = this;
  116.             this.web.Navigate(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "\\web\\index.html");
  117.         }
  118.  
  119.         [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
  120.         public void OpenDatabases()
  121.         {
  122.             try
  123.             {
  124.                 try
  125.                 {
  126.                     this.dbApp.Open();
  127.                 }
  128.                 catch (Exception ex)
  129.                 {
  130.                     if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-app.db"))
  131.                     {
  132.                         File.Create(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-app.db").Dispose();
  133.                     }
  134.                     this.dbApp.Open();
  135.                 }
  136.                 try
  137.                 {
  138.                     this.dbBrowser.Open();
  139.                 }
  140.                 catch (Exception ex2)
  141.                 {
  142.                     if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-browser.db"))
  143.                     {
  144.                         File.Create(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-browser.db").Dispose();
  145.                     }
  146.                     this.dbBrowser.Open();
  147.                 }
  148.                 try
  149.                 {
  150.                     this.dbHelper.Open();
  151.                 }
  152.                 catch (Exception ex3)
  153.                 {
  154.                     if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-helper.db"))
  155.                     {
  156.                         File.Create(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-helper.db").Dispose();
  157.                     }
  158.                     this.dbHelper.Open();
  159.                 }
  160.                 try
  161.                 {
  162.                     this.dbService.Open();
  163.                 }
  164.                 catch (Exception ex4)
  165.                 {
  166.                     if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-service.db"))
  167.                     {
  168.                         File.Create(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-service.db").Dispose();
  169.                     }
  170.                     this.dbService.Open();
  171.                 }
  172.             }
  173.             catch (Exception e)
  174.             {
  175.                 this.WriteError(e);
  176.                 Interaction.MsgBox("The databases where your settings are stored are locked and can't be opened. Try opening Cold Turkey Blocker in a few seconds.", MsgBoxStyle.Exclamation, "Error Reading Database");
  177.                 ProjectData.EndApp();
  178.             }
  179.         }
  180.  
  181.         [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
  182.         public bool HandleCommandLineArguments(string[] args, bool secondInstance)
  183.         {
  184.             bool result = false;
  185.             try
  186.             {
  187.                 if (args.Count<string>() > 1)
  188.                 {
  189.                     bool flag = !secondInstance;
  190.                     ColdTurkey.AttachConsole(-1);
  191.                     Console.WriteLine("\r\n");
  192.                     string text = args[1];
  193.                     uint num = <PrivateImplementationDetails>.ComputeStringHash(text);
  194.                     if (num <= 1229256295U)
  195.                     {
  196.                         if (num != 474815838U)
  197.                         {
  198.                             if (num != 736341131U)
  199.                             {
  200.                                 if (num != 1229256295U)
  201.                                 {
  202.                                     goto IL_9C3;
  203.                                 }
  204.                                 if (Operators.CompareString(text, "-show-extension-install", false) != 0)
  205.                                 {
  206.                                     goto IL_9C3;
  207.                                 }
  208.                                 if (secondInstance)
  209.                                 {
  210.                                     this.web.Document.InvokeScript("ForceExtensionInstall", new object[]
  211.                                     {
  212.                                         this.GetBrowserInstallList()
  213.                                     });
  214.                                     this.OpenWindow(false);
  215.                                 }
  216.                                 else
  217.                                 {
  218.                                     this.settings.Additional.ForceExtensionInstall = "true";
  219.                                 }
  220.                                 flag = false;
  221.                                 result = true;
  222.                                 goto IL_9CD;
  223.                             }
  224.                             else if (Operators.CompareString(text, "-help", false) != 0)
  225.                             {
  226.                                 goto IL_9C3;
  227.                             }
  228.                         }
  229.                         else
  230.                         {
  231.                             if (Operators.CompareString(text, "-first-run", false) != 0)
  232.                             {
  233.                                 goto IL_9C3;
  234.                             }
  235.                             this.firstRun = true;
  236.                             this.settings.Additional.ForceExtensionInstall = "true";
  237.                             flag = false;
  238.                             result = true;
  239.                             goto IL_9CD;
  240.                         }
  241.                     }
  242.                     else
  243.                     {
  244.                         if (num <= 3528909995U)
  245.                         {
  246.                             if (num != 2665476292U)
  247.                             {
  248.                                 if (num != 3528909995U)
  249.                                 {
  250.                                     goto IL_9C3;
  251.                                 }
  252.                                 if (Operators.CompareString(text, "-add", false) != 0)
  253.                                 {
  254.                                     goto IL_9C3;
  255.                                 }
  256.                                 goto IL_732;
  257.                             }
  258.                             else if (Operators.CompareString(text, "-start", false) != 0)
  259.                             {
  260.                                 goto IL_9C3;
  261.                             }
  262.                         }
  263.                         else
  264.                         {
  265.                             if (num != 3872925760U)
  266.                             {
  267.                                 if (num != 4232490106U)
  268.                                 {
  269.                                     goto IL_9C3;
  270.                                 }
  271.                                 if (Operators.CompareString(text, "-pause", false) != 0)
  272.                                 {
  273.                                     goto IL_9C3;
  274.                                 }
  275.                             }
  276.                             else
  277.                             {
  278.                                 if (Operators.CompareString(text, "-stop", false) != 0)
  279.                                 {
  280.                                     goto IL_9C3;
  281.                                 }
  282.                                 try
  283.                                 {
  284.                                     if (Operators.CompareString(args[2], "ServiceHubHelperTimer", false) == 0)
  285.                                     {
  286.                                         string text2 = args[3];
  287.                                         if (text2 != null)
  288.                                         {
  289.                                             if (this.settings.Blocks[text2] != null)
  290.                                             {
  291.                                                 if (Operators.CompareString(this.settings.Blocks[text2].LockUnblock, "true", false) == 0 & this.settings.Blocks[text2].Lock.Contains(","))
  292.                                                 {
  293.                                                     this.settings.Blocks[text2].Enabled = "false";
  294.                                                 }
  295.                                                 else if (Operators.CompareString(text2, "Frozen Turkey", false) == 0)
  296.                                                 {
  297.                                                     this.settings.Blocks[text2].Enabled = "false";
  298.                                                 }
  299.                                                 this.settings.Blocks[text2].Lock = "none";
  300.                                                 this.settings.Blocks[text2].Timer = "";
  301.                                                 this.WriteSettingsToDatabase();
  302.                                                 this.PipeSettingsReloadMessage();
  303.                                                 if (secondInstance)
  304.                                                 {
  305.                                                     this.ForceSettingsReload();
  306.                                                 }
  307.                                             }
  308.                                             else
  309.                                             {
  310.                                                 Console.WriteLine("Print available command line arguments using -help\r\n");
  311.                                             }
  312.                                         }
  313.                                         else
  314.                                         {
  315.                                             Console.WriteLine("Print available command line arguments using -help\r\n");
  316.                                         }
  317.                                     }
  318.                                     else if (Operators.CompareString(args[2], "ServiceHubHelperRestarted", false) == 0)
  319.                                     {
  320.                                         try
  321.                                         {
  322.                                             foreach (KeyValuePair<string, Block> keyValuePair in this.settings.Blocks)
  323.                                             {
  324.                                                 if (Operators.CompareString(keyValuePair.Value.Lock, "restart", false) == 0)
  325.                                                 {
  326.                                                     if (Operators.CompareString(keyValuePair.Value.RestartUnblock, "true", false) == 0)
  327.                                                     {
  328.                                                         keyValuePair.Value.Enabled = "false";
  329.                                                     }
  330.                                                     keyValuePair.Value.Lock = "none";
  331.                                                     keyValuePair.Value.Timer = "";
  332.                                                 }
  333.                                             }
  334.                                         }
  335.                                         finally
  336.                                         {
  337.                                             Dictionary<string, Block>.Enumerator enumerator;
  338.                                             ((IDisposable)enumerator).Dispose();
  339.                                         }
  340.                                         this.WriteSettingsToDatabase();
  341.                                         this.PipeSettingsReloadMessage();
  342.                                         if (secondInstance)
  343.                                         {
  344.                                             this.ForceSettingsReload();
  345.                                         }
  346.                                     }
  347.                                     else
  348.                                     {
  349.                                         Console.WriteLine("Print available command line arguments using -help\r\n");
  350.                                     }
  351.                                     goto IL_9CD;
  352.                                 }
  353.                                 catch (Exception ex)
  354.                                 {
  355.                                     Console.WriteLine("Print available command line arguments using -help\r\n");
  356.                                     goto IL_9CD;
  357.                                 }
  358.                             }
  359.                             try
  360.                             {
  361.                                 if (Operators.CompareString(args[2], "ServiceHubHelper", false) == 0)
  362.                                 {
  363.                                     if (Operators.CompareString(args[3], "start", false) == 0)
  364.                                     {
  365.                                         if (Operators.CompareString(this.settings.Settings.BlockCharity, "true", false) != 0)
  366.                                         {
  367.                                             DateTime dateTime = DateAndTime.Now.AddMinutes(10.0);
  368.                                             this.settings.Additional.Paused = string.Concat(new string[]
  369.                                             {
  370.                                                 dateTime.Year.ToString(),
  371.                                                 ",",
  372.                                                 dateTime.Month.ToString(),
  373.                                                 ",",
  374.                                                 dateTime.Day.ToString(),
  375.                                                 ",",
  376.                                                 dateTime.Hour.ToString(),
  377.                                                 ",",
  378.                                                 dateTime.Minute.ToString(),
  379.                                                 ",",
  380.                                                 dateTime.Second.ToString()
  381.                                             });
  382.                                             this.WriteSettingsToDatabase();
  383.                                             this.PipeSettingsReloadMessage();
  384.                                             if (secondInstance)
  385.                                             {
  386.                                                 this.ForceSettingsReload();
  387.                                             }
  388.                                             this.tray.BalloonTipTitle = "Your blocks are paused for 10 minutes!";
  389.                                             this.tray.BalloonTipText = "Please do not log off to enjoy the full 10 minutes. Thanks for your donation!";
  390.                                             this.tray.BalloonTipIcon = ToolTipIcon.Info;
  391.                                             this.previousTrayVisibleState = this.tray.Visible;
  392.                                             this.tray.Visible = true;
  393.                                             this.tray.ShowBalloonTip(10000);
  394.                                         }
  395.                                     }
  396.                                     else
  397.                                     {
  398.                                         this.settings.Additional.Paused = "false";
  399.                                         this.WriteSettingsToDatabase();
  400.                                         this.PipeSettingsReloadMessage();
  401.                                         if (secondInstance)
  402.                                         {
  403.                                             this.ForceSettingsReload();
  404.                                         }
  405.                                         this.tray.BalloonTipTitle = "Your blocks have resumed!";
  406.                                         this.tray.BalloonTipText = "Thanks for taking a pause for a cause!";
  407.                                         this.tray.BalloonTipIcon = ToolTipIcon.Info;
  408.                                         this.previousTrayVisibleState = this.tray.Visible;
  409.                                         this.tray.Visible = true;
  410.                                         this.tray.ShowBalloonTip(10000);
  411.                                     }
  412.                                 }
  413.                                 else
  414.                                 {
  415.                                     Console.WriteLine("Print available command line arguments using -help\r\n");
  416.                                 }
  417.                                 goto IL_9CD;
  418.                             }
  419.                             catch (Exception ex2)
  420.                             {
  421.                                 Console.WriteLine("Print available command line arguments using -help\r\n");
  422.                                 goto IL_9CD;
  423.                             }
  424.                         }
  425.                         try
  426.                         {
  427.                             string text3 = args[2];
  428.                             if (text3 != null & Operators.CompareString(text3, "Frozen Turkey", false) != 0)
  429.                             {
  430.                                 if (this.settings.Blocks[text3] != null)
  431.                                 {
  432.                                     if (Operators.CompareString(this.settings.Blocks[text3].Enabled, "true", false) != 0)
  433.                                     {
  434.                                         try
  435.                                         {
  436.                                             string left = args[3];
  437.                                             string text4 = args[4];
  438.                                             if ((((-(((Operators.CompareString(left, "-lock", false) == 0) > false) ? 1 : 0)) ? 1 : 0) & int.Parse(text4)) != 0)
  439.                                             {
  440.                                                 this.QuickStart("command", text3, text4);
  441.                                                 this.PipeSettingsReloadMessage();
  442.                                                 if (secondInstance)
  443.                                                 {
  444.                                                     this.ForceSettingsReload();
  445.                                                 }
  446.                                             }
  447.                                             else
  448.                                             {
  449.                                                 Console.WriteLine("Error: Lock parameters are invalid.\r\n");
  450.                                             }
  451.                                             goto IL_711;
  452.                                         }
  453.                                         catch (Exception ex3)
  454.                                         {
  455.                                             this.QuickStart("command", text3, "0");
  456.                                             this.PipeSettingsReloadMessage();
  457.                                             if (secondInstance)
  458.                                             {
  459.                                                 this.ForceSettingsReload();
  460.                                             }
  461.                                             goto IL_711;
  462.                                         }
  463.                                     }
  464.                                     Console.WriteLine("Error: Block is already started.\r\n");
  465.                                 }
  466.                                 else
  467.                                 {
  468.                                     Console.WriteLine("Error: Block name is invalid. No block named " + text3 + " was found.\r\n");
  469.                                 }
  470.                             }
  471.                             else
  472.                             {
  473.                                 Console.WriteLine("Error: Block name is invalid. Frozen Turkey can not be started via command line.\r\n");
  474.                             }
  475.                             IL_711:
  476.                             goto IL_9CD;
  477.                         }
  478.                         catch (Exception ex4)
  479.                         {
  480.                             Console.WriteLine("Error: Block name not specified.\r\n");
  481.                             goto IL_9CD;
  482.                         }
  483.                         IL_732:
  484.                         try
  485.                         {
  486.                             string text5 = args[2];
  487.                             if (text5 != null & Operators.CompareString(text5, "Frozen Turkey", false) != 0)
  488.                             {
  489.                                 if (this.settings.Blocks[text5] != null)
  490.                                 {
  491.                                     try
  492.                                     {
  493.                                         string left2 = args[3];
  494.                                         string text6 = args[4];
  495.                                         if (text6.StartsWith("https://") | text6.StartsWith("http://") | text6.StartsWith("ftp://"))
  496.                                         {
  497.                                             if (text6.Contains("://"))
  498.                                             {
  499.                                                 text6 = text6.Substring(checked(text6.IndexOf("://") + 3));
  500.                                             }
  501.                                             if (text6.StartsWith("www."))
  502.                                             {
  503.                                                 text6 = text6.Substring(4);
  504.                                             }
  505.                                         }
  506.                                         else if (!text6.StartsWith("file://"))
  507.                                         {
  508.                                             Console.WriteLine("Error: URL protocol is not supported.\r\n");
  509.                                         }
  510.                                         if (Operators.CompareString(left2, "-web", false) == 0)
  511.                                         {
  512.                                             if (!this.settings.Blocks[text5].Web.Contains(text6))
  513.                                             {
  514.                                                 this.settings.Blocks[text5].Web.Add(text6);
  515.                                                 this.WriteSettingsToDatabase();
  516.                                                 this.PipeSettingsReloadMessage();
  517.                                                 if (secondInstance)
  518.                                                 {
  519.                                                     this.ForceSettingsReload();
  520.                                                 }
  521.                                             }
  522.                                         }
  523.                                         else if (Operators.CompareString(left2, "-exception", false) == 0)
  524.                                         {
  525.                                             if (Operators.CompareString(this.settings.Blocks[text5].Lock, "none", false) != 0)
  526.                                             {
  527.                                                 this.settings.Blocks[text5].Exceptions.Add(text6);
  528.                                                 this.WriteSettingsToDatabase();
  529.                                                 this.PipeSettingsReloadMessage();
  530.                                                 if (secondInstance)
  531.                                                 {
  532.                                                     this.ForceSettingsReload();
  533.                                                 }
  534.                                             }
  535.                                             else
  536.                                             {
  537.                                                 Console.WriteLine("Error: Can not add exceptions to a locked block.\r\n");
  538.                                             }
  539.                                         }
  540.                                         else
  541.                                         {
  542.                                             Console.WriteLine("Error: Invalid block tab specified.\r\n");
  543.                                         }
  544.                                         goto IL_918;
  545.                                     }
  546.                                     catch (Exception ex5)
  547.                                     {
  548.                                         Console.WriteLine("Error: Invalid number of parameters specified.\r\n");
  549.                                         goto IL_918;
  550.                                     }
  551.                                 }
  552.                                 Console.WriteLine("Error: Block name is invalid. No block named " + text5 + " was found.\r\n");
  553.                             }
  554.                             else
  555.                             {
  556.                                 Console.WriteLine("Error: Block name is invalid. Can not add websites to Frozen Turkey.\r\n");
  557.                             }
  558.                             IL_918:
  559.                             goto IL_9CD;
  560.                         }
  561.                         catch (Exception ex6)
  562.                         {
  563.                             Console.WriteLine("Error: Block name not specified.\r\n");
  564.                             goto IL_9CD;
  565.                         }
  566.                     }
  567.                     Console.WriteLine("Cold Turkey Blocker [Version " + this.currentVersion.ToString("0.00") + "]\r\nCopyright (c) 2020. Cold Turkey Software Inc.\r\n");
  568.                     Console.WriteLine("Cold Turkey Blocker.exe [options]\r\n");
  569.                     Console.WriteLine("  Where [options] must be one of following formats:\r\n");
  570.                     Console.WriteLine("  [-start \"Block Name\"]");
  571.                     Console.WriteLine("  Starts an unlocked block with the specified name. The block must already exist and not be enabled.\r\n");
  572.                     Console.WriteLine("  [-start \"Block Name\" -lock X]");
  573.                     Console.WriteLine("  Starts a locked block for X number of minutes with the specified name. The block must already exist and not be enabled.\r\n");
  574.                     Console.WriteLine("  [-add \"Block Name\" -web \"URL\"]");
  575.                     Console.WriteLine("  Adds a URL to the website tab of a block with the specified name. The block must already exist.\r\n");
  576.                     Console.WriteLine("  [-add \"Block Name\" -exception \"URL\"]");
  577.                     Console.WriteLine("  Adds a URL to the exception tab of a block with the specified name. The block must already exist and not be locked.\r\n");
  578.                     goto IL_9CD;
  579.                     IL_9C3:
  580.                     Console.WriteLine("Invalid arguments. Show available command line arguments using -help\r\n");
  581.                     IL_9CD:
  582.                     if (flag)
  583.                     {
  584.                         SendKeys.SendWait("{ENTER}");
  585.                         this.DisposeOpenObjects();
  586.                         ProjectData.EndApp();
  587.                     }
  588.                 }
  589.                 else if (secondInstance)
  590.                 {
  591.                     this.OpenWindow(true);
  592.                 }
  593.             }
  594.             catch (Exception ex7)
  595.             {
  596.                 this.DisposeOpenObjects();
  597.                 ProjectData.EndApp();
  598.             }
  599.             return result;
  600.         }
  601.  
  602.         public void PipeSettingsReloadMessage()
  603.         {
  604.             NamedPipeClientStream namedPipeClientStream = new NamedPipeClientStream("CTBAppToService");
  605.             StreamWriter streamWriter = new StreamWriter(namedPipeClientStream);
  606.             NamedPipeClientStream namedPipeClientStream2 = new NamedPipeClientStream("CTBAppToHelper");
  607.             StreamWriter streamWriter2 = new StreamWriter(namedPipeClientStream2);
  608.             try
  609.             {
  610.                 namedPipeClientStream.Connect(500);
  611.                 streamWriter.WriteLine("-reload-settings");
  612.                 streamWriter.Flush();
  613.                 streamWriter.Dispose();
  614.                 namedPipeClientStream.Dispose();
  615.             }
  616.             catch (Exception ex)
  617.             {
  618.             }
  619.             try
  620.             {
  621.                 namedPipeClientStream2.Connect(500);
  622.                 streamWriter2.WriteLine("-reload-settings");
  623.                 streamWriter2.Flush();
  624.                 streamWriter2.Dispose();
  625.                 streamWriter2.Dispose();
  626.             }
  627.             catch (Exception ex2)
  628.             {
  629.             }
  630.         }
  631.  
  632.         public void ForceSettingsReload()
  633.         {
  634.             this.LoadSettings();
  635.             this.web.Document.InvokeScript("ForceSettingsUpdate", new object[]
  636.             {
  637.                 this.SendSettings()
  638.             });
  639.         }
  640.  
  641.         [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
  642.         private void LoadSettings()
  643.         {
  644.             try
  645.             {
  646.                 if (Conversions.ToInteger(new SQLiteCommand("PRAGMA user_version", this.dbHelper).ExecuteScalar()) < 4)
  647.                 {
  648.                     Interaction.MsgBox("The settings database has not been upgraded to the latest version yet. Try opening Cold Turkey Blocker in a few seconds.", MsgBoxStyle.Exclamation, "Error Reading Database");
  649.                     ProjectData.EndApp();
  650.                 }
  651.                 else
  652.                 {
  653.                     string text = new SQLiteCommand("SELECT value from settings where key = 'settings'", this.dbApp).ExecuteScalar() as string;
  654.                     if (text != null & Operators.CompareString(text, "", false) != 0)
  655.                     {
  656.                         this.settings = JsonConvert.DeserializeAnonymousType<Settings>(text, this.settings);
  657.                     }
  658.                     else
  659.                     {
  660.                         this.ResetSettings();
  661.                     }
  662.                 }
  663.             }
  664.             catch (Exception e)
  665.             {
  666.                 this.WriteError(e);
  667.                 Interaction.MsgBox("The database where your settings are stored is locked and can't be read. Try opening Cold Turkey Blocker in a few seconds.", MsgBoxStyle.Exclamation, "Error Reading Database");
  668.                 ProjectData.EndApp();
  669.             }
  670.         }
  671.  
  672.         private void SetAdditionalUpdate()
  673.         {
  674.             try
  675.             {
  676.                 if (this.CheckConnection() && double.Parse(Regex.Replace(this.GetHTML("https://getcoldturkey.com/version/windows/"), "\\\\s+", string.Empty), CultureInfo.InvariantCulture) > this.currentVersion)
  677.                 {
  678.                     this.settings.Additional.UpdateAvailable = "true";
  679.                     return;
  680.                 }
  681.             }
  682.             catch (Exception ex)
  683.             {
  684.             }
  685.             this.settings.Additional.UpdateAvailable = "false";
  686.         }
  687.  
  688.         private void SetAdditionalWin10()
  689.         {
  690.             List<string> list = new List<string>();
  691.             try
  692.             {
  693.                 SQLiteDataReader sqliteDataReader = new SQLiteCommand("Select * FROM apps", this.dbService).ExecuteReader();
  694.                 while (sqliteDataReader.Read())
  695.                 {
  696.                     list.Add(sqliteDataReader["file"].ToString().Substring(checked(sqliteDataReader["file"].ToString().LastIndexOf('\\') + 1)));
  697.                 }
  698.             }
  699.             catch (Exception ex)
  700.             {
  701.             }
  702.             this.settings.Additional.Win10 = list;
  703.         }
  704.  
  705.         private void SetAdditionalUsers()
  706.         {
  707.             List<string> list = new List<string>();
  708.             try
  709.             {
  710.                 SelectQuery query = new SelectQuery("Win32_UserAccount");
  711.                 ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher(query);
  712.                 try
  713.                 {
  714.                     foreach (ManagementBaseObject managementBaseObject in managementObjectSearcher.Get())
  715.                     {
  716.                         string text = ((ManagementObject)managementBaseObject)["Name"].ToString();
  717.                         if (Operators.CompareString(text, "WDAGUtilityAccount", false) != 0 & Operators.CompareString(text, "DefaultAccount", false) != 0 & Operators.CompareString(text, "defaultuser0", false) != 0)
  718.                         {
  719.                             list.Add(text);
  720.                         }
  721.                     }
  722.                 }
  723.                 finally
  724.                 {
  725.                     ManagementObjectCollection.ManagementObjectEnumerator enumerator;
  726.                     if (enumerator != null)
  727.                     {
  728.                         ((IDisposable)enumerator).Dispose();
  729.                     }
  730.                 }
  731.             }
  732.             catch (Exception ex)
  733.             {
  734.             }
  735.             new Settings();
  736.             this.settings.Additional.Users = list;
  737.         }
  738.  
  739.         private void SetWindowTitle()
  740.         {
  741.             string proStatus = this.settings.Additional.ProStatus;
  742.             if (Operators.CompareString(proStatus, "free", false) == 0)
  743.             {
  744.                 this.Text = "Cold Turkey Blocker Free (v" + this.currentVersion.ToString("0.00") + ")";
  745.                 return;
  746.             }
  747.             if (Operators.CompareString(proStatus, "trial", false) == 0)
  748.             {
  749.                 string[] array = this.settings.Additional.TrialEnd.Split(new string[]
  750.                 {
  751.                     ","
  752.                 });
  753.                 DateTime dateTime = new DateTime(Conversions.ToInteger(array[0]), Conversions.ToInteger(array[1]), Conversions.ToInteger(array[2]), Conversions.ToInteger(array[3]), Conversions.ToInteger(array[4]), 0);
  754.                 this.Text = string.Concat(new string[]
  755.                 {
  756.                     "Cold Turkey Blocker (Pro trial ends: ",
  757.                     dateTime.ToString("f", CultureInfo.CurrentCulture),
  758.                     ") (v",
  759.                     this.currentVersion.ToString("0.00"),
  760.                     ")"
  761.                 });
  762.                 return;
  763.             }
  764.             if (Operators.CompareString(proStatus, "trialed", false) == 0)
  765.             {
  766.                 this.Text = "Cold Turkey Blocker Free (v" + this.currentVersion.ToString("0.00") + ")";
  767.                 return;
  768.             }
  769.             if (Operators.CompareString(proStatus, "pro", false) != 0)
  770.             {
  771.                 return;
  772.             }
  773.             this.Text = "Cold Turkey Blocker Pro (v" + this.currentVersion.ToString("0.00") + ")";
  774.         }
  775.  
  776.         [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
  777.         private void ResetSettings()
  778.         {
  779.             try
  780.             {
  781.                 string value = "{\"blocks\":{\"Frozen Turkey\":{\"enabled\":\"false\",\"type\":\"continuous\",\"timer\":\"\",\"startTime\":\"\",\"lock\":\"none\",\"lockUnblock\":\"true\",\"restartUnblock\":\"\",\"break\":\"none\",\"password\":\"\",\"randomTextLength\":\"30\",\"window\":\"lock@9,0@17,0\",\"users\":\"all\",\"web\":[],\"exceptions\":[],\"apps\":[],\"schedule\":[],\"customUsers\":[]},\"Distractions\":{\"enabled\":\"false\",\"type\":\"continuous\",\"timer\":\"\",\"startTime\":\"\",\"lock\":\"none\",\"lockUnblock\":\"true\",\"restartUnblock\":\"true\",\"break\":\"none\",\"password\":\"\",\"randomTextLength\":\"30\",\"window\":\"lock@9,0@17,0\",\"users\":\"all\",\"web\":[\"4chan.org\",\"9gag.com\",\"badoo.com\",\"buzzfeed.com\",\"facebook.com\",\"imgur.com\",\"instagram.com\",\"linkedin.com\",\"mashable.com\",\"myspace.com\",\"netflix.com\",\"pinterest.com\",\"qzone.qq.com\",\"reddit.com\",\"skype.com\",\"snapchat.com\",\"tagged.com\",\"tieba.baidu.com\",\"tumblr.com\",\"twitter.com\",\"vimeo.com\",\"vk.com\",\"weibo.com\",\"youtube.com\",\"yy.com\"],\"exceptions\":[],\"apps\":[],\"schedule\":[],\"customUsers\":[]}},\"settings\":{\"show24hour\":\"false\",\"weekStart\":\"sunday\",\"theme\":\"light\",\"openStartup\":\"false\",\"closeToTray\":\"true\",\"showExtensionWarning\":\"true\",\"notifyDone\":\"true\",\"notifyStart\":\"true\",\"notifyEnd\":\"true\",\"notifyBreak\":\"true\",\"notifyAllowance\":\"true\",\"notifyBlock\":\"true\",\"notifyWarning\":\"true\",\"notifyWarningPeriod\":\"2\",\"notifyWarningAllowance\":\"true\",\"notifyAllowancePeriod\":\"2\",\"blockMode\":\"exit\",\"frozenTurkeyMode\":\"lock\",\"blockCharity\":\"false\",\"blockUnsupported\":\"true\",\"blockInstaller\":\"false\",\"blockTaskManager\":\"false\",\"blockTaskManagerChrome\":\"false\",\"blockTimeChange\":\"false\",\"blockEmbedded\":\"false\",\"blockInactive\":\"false\",\"forceAllowFile\":\"false\",\"extensionGracePeriod\":\"60\",\"password\":\"\",\"passwordStrict\":\"false\",\"statsEnabled\":\"true\",\"statsEnabledIncognito\":\"true\",\"statsStrict\":\"false\"},\"additional\":{\"paused\":\"false\",\"proStatus\":\"free\",\"trialEnd\":\"\",\"updateAvailable\":\"false\",\"browserList\":\"\",\"forceExtensionInstall\":\"true\",\"win10\":[],\"users\":[]}}";
  782.                 new SQLiteCommand("INSERT OR REPLACE INTO settings (key, value) VALUES ('settings', @settings)", this.dbApp)
  783.                 {
  784.                     Parameters =
  785.                     {
  786.                         new SQLiteParameter("@settings", value)
  787.                     }
  788.                 }.ExecuteNonQuery();
  789.                 string text = new SQLiteCommand("SELECT value from settings where key = 'settings'", this.dbApp).ExecuteScalar() as string;
  790.                 if (text != null & Operators.CompareString(text, "", false) != 0)
  791.                 {
  792.                     this.settings = JsonConvert.DeserializeAnonymousType<Settings>(text, this.settings);
  793.                 }
  794.             }
  795.             catch (Exception e)
  796.             {
  797.                 this.WriteError(e);
  798.                 Interaction.MsgBox("Your settings could not be reset. Try opening Cold Turkey Blocker in a few seconds.", MsgBoxStyle.Exclamation, "Error Resetting Settings");
  799.                 ProjectData.EndApp();
  800.             }
  801.         }
  802.  
  803.         [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
  804.         public string SendSettings()
  805.         {
  806.             string result;
  807.             try
  808.             {
  809.                 result = JsonConvert.SerializeObject(this.settings).Replace("\\\\'", "\\\\\\\\\\'");
  810.             }
  811.             catch (Exception e)
  812.             {
  813.                 this.WriteError(e);
  814.                 Interaction.MsgBox("Your settings could not be sent to the web application. Try opening Cold Turkey Blocker in a few seconds.", MsgBoxStyle.Exclamation, "Error Sending Settings");
  815.                 ProjectData.EndApp();
  816.             }
  817.             return result;
  818.         }
  819.  
  820.         [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
  821.         public string SendAllowanceUpdate()
  822.         {
  823.             string result;
  824.             try
  825.             {
  826.                 result = JsonConvert.SerializeObject(this.allowances).Replace("\\\\'", "\\\\\\\\\\'");
  827.             }
  828.             catch (Exception e)
  829.             {
  830.                 this.WriteError(e);
  831.                 Interaction.MsgBox("Your allowance data could not be sent to the web application. Try opening Cold Turkey Blocker in a few seconds.", MsgBoxStyle.Exclamation, "Error Sending Allowances");
  832.                 ProjectData.EndApp();
  833.             }
  834.             return result;
  835.         }
  836.  
  837.         private void CalculateAllowances()
  838.         {
  839.             checked
  840.             {
  841.                 try
  842.                 {
  843.                     if (this.settings != null)
  844.                     {
  845.                         this.allowances = new Dictionary<string, string>();
  846.                         try
  847.                         {
  848.                             foreach (KeyValuePair<string, Block> keyValuePair in this.settings.Blocks)
  849.                             {
  850.                                 if ((Operators.CompareString(keyValuePair.Value.Users, "all", false) == 0 | keyValuePair.Value.CustomUsers.Contains(Environment.UserName)) && Operators.CompareString(keyValuePair.Value.Enabled, "true", false) == 0)
  851.                                 {
  852.                                     bool flag = false;
  853.                                     string text = "none";
  854.                                     DateTime dateTime;
  855.                                     DateTime endTime;
  856.                                     if (Operators.CompareString(keyValuePair.Value.Type, "continuous", false) == 0)
  857.                                     {
  858.                                         flag = true;
  859.                                         text = keyValuePair.Value.Break;
  860.                                         string[] array = keyValuePair.Value.StartTime.Split(new string[]
  861.                                         {
  862.                                             ","
  863.                                         });
  864.                                         dateTime = new DateTime(int.Parse(array[0]), int.Parse(array[1]), int.Parse(array[2]), int.Parse(array[3]), int.Parse(array[4]), 0, 0);
  865.                                         if (DateTime.Compare(dateTime, new DateTime(DateAndTime.Now.Year, DateAndTime.Now.Month, DateAndTime.Now.Day, 0, 0, 0, 0)) < 0)
  866.                                         {
  867.                                             dateTime = new DateTime(DateAndTime.Now.Year, DateAndTime.Now.Month, DateAndTime.Now.Day, 0, 0, 0, 0);
  868.                                         }
  869.                                         endTime = new DateTime(DateAndTime.Now.Year, DateAndTime.Now.Month, DateAndTime.Now.Day, 0, 0, 0, 0);
  870.                                         endTime = endTime.AddHours(24.0);
  871.                                     }
  872.                                     else
  873.                                     {
  874.                                         try
  875.                                         {
  876.                                             foreach (Schedule schedule in keyValuePair.Value.Schedule)
  877.                                             {
  878.                                                 string[] array2 = schedule.StartTime.Split(new string[]
  879.                                                 {
  880.                                                     ","
  881.                                                 });
  882.                                                 string[] array3 = schedule.EndTime.Split(new string[]
  883.                                                 {
  884.                                                     ","
  885.                                                 });
  886.                                                 if (int.Parse(array2[0]) == (int)DateAndTime.Now.DayOfWeek)
  887.                                                 {
  888.                                                     DateTime dateTime2 = new DateTime(DateAndTime.Now.Year, DateAndTime.Now.Month, DateAndTime.Now.Day, int.Parse(array2[1]), int.Parse(array2[2]), 0, 0);
  889.                                                     DateTime dateTime3 = new DateTime(DateAndTime.Now.Year, DateAndTime.Now.Month, DateAndTime.Now.Day, int.Parse(array3[1]), int.Parse(array3[2]), 0, 0);
  890.                                                     if (DateTime.Compare(dateTime2, DateAndTime.Now) <= 0 & DateTime.Compare(DateAndTime.Now, dateTime3) < 0)
  891.                                                     {
  892.                                                         flag = true;
  893.                                                         text = schedule.Break;
  894.                                                         dateTime = dateTime2;
  895.                                                         endTime = dateTime3;
  896.                                                     }
  897.                                                 }
  898.                                             }
  899.                                         }
  900.                                         finally
  901.                                         {
  902.                                             List<Schedule>.Enumerator enumerator2;
  903.                                             ((IDisposable)enumerator2).Dispose();
  904.                                         }
  905.                                     }
  906.                                     if (flag && (Operators.CompareString(text, "none", false) != 0 & !text.Contains(",")))
  907.                                     {
  908.                                         int num = int.Parse(text);
  909.                                         if (Operators.CompareString(keyValuePair.Key, "Frozen Turkey", false) == 0)
  910.                                         {
  911.                                             int num2 = Convert.ToInt32(Math.Floor(new decimal(num * 60 - this.GetSecondsSpentOnAnything(dateTime, endTime))));
  912.                                             if (num2 < 0)
  913.                                             {
  914.                                                 num2 = 0;
  915.                                             }
  916.                                             this.allowances.Add(keyValuePair.Key, num2.ToString(CultureInfo.InvariantCulture));
  917.                                         }
  918.                                         else
  919.                                         {
  920.                                             int num3 = Convert.ToInt32(Math.Floor(new decimal(num * 60 - this.GetSecondsSpentOn(keyValuePair.Key, dateTime, endTime))));
  921.                                             if (num3 < 0)
  922.                                             {
  923.                                                 num3 = 0;
  924.                                             }
  925.                                             this.allowances.Add(keyValuePair.Key, num3.ToString(CultureInfo.InvariantCulture));
  926.                                         }
  927.                                     }
  928.                                 }
  929.                             }
  930.                         }
  931.                         finally
  932.                         {
  933.                             Dictionary<string, Block>.Enumerator enumerator;
  934.                             ((IDisposable)enumerator).Dispose();
  935.                         }
  936.                     }
  937.                 }
  938.                 catch (Exception ex)
  939.                 {
  940.                 }
  941.             }
  942.         }
  943.  
  944.         private int GetSecondsSpentOn(string blockId, DateTime startTime, DateTime endTime)
  945.         {
  946.             string text = startTime.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString("F0");
  947.             string text2 = endTime.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString("F0");
  948.             List<string> list = new List<string>();
  949.             string text3 = Environment.UserName.Replace("'", "''");
  950.             foreach (string text4 in this.settings.Blocks[blockId].Web.Distinct<string>().ToArray<string>())
  951.             {
  952.                 try
  953.                 {
  954.                     foreach (string text5 in this.settings.Blocks[blockId].Exceptions.Distinct<string>())
  955.                     {
  956.                         if (new Regex(text4.Replace("*", ".*")).IsMatch(text5.Replace("*", ".*")))
  957.                         {
  958.                             list.Add(text5);
  959.                         }
  960.                     }
  961.                 }
  962.                 finally
  963.                 {
  964.                     IEnumerator<string> enumerator;
  965.                     if (enumerator != null)
  966.                     {
  967.                         enumerator.Dispose();
  968.                     }
  969.                 }
  970.             }
  971.             int num = 0;
  972.             checked
  973.             {
  974.                 try
  975.                 {
  976.                     foreach (string text6 in this.settings.Blocks[blockId].Web.Distinct<string>())
  977.                     {
  978.                         int num2 = 0;
  979.                         string text7 = text6.Replace("%", "\\%").Replace("*", "%").Replace("'", "''");
  980.                         string text8;
  981.                         if (!text7.Contains("/"))
  982.                         {
  983.                             text8 = string.Concat(new string[]
  984.                             {
  985.                                 "SELECT SUM(seconds) FROM stats WHERE (date >= ",
  986.                                 text,
  987.                                 " AND date < ",
  988.                                 text2,
  989.                                 ") AND user = '",
  990.                                 text3,
  991.                                 "' AND (domain = '",
  992.                                 text7,
  993.                                 "' OR domain LIKE '%.",
  994.                                 text7,
  995.                                 "' ESCAPE '\\' OR domain LIKE '",
  996.                                 text7,
  997.                                 "/%' ESCAPE '\\' OR domain LIKE '%.",
  998.                                 text7,
  999.                                 "/%' ESCAPE '\\')"
  1000.                             });
  1001.                         }
  1002.                         else
  1003.                         {
  1004.                             text8 = string.Concat(new string[]
  1005.                             {
  1006.                                 "SELECT SUM(seconds) FROM stats WHERE (date >= ",
  1007.                                 text,
  1008.                                 " AND date < ",
  1009.                                 text2,
  1010.                                 ") AND user = '",
  1011.                                 text3,
  1012.                                 "' AND (domain = '",
  1013.                                 text7,
  1014.                                 "' OR domain LIKE '%.",
  1015.                                 text7,
  1016.                                 "%' ESCAPE '\\')"
  1017.                             });
  1018.                         }
  1019.                         if (text8 != null && int.TryParse(new SQLiteCommand(text8, this.dbBrowser).ExecuteScalar().ToString(), out num2))
  1020.                         {
  1021.                             num += num2;
  1022.                         }
  1023.                     }
  1024.                 }
  1025.                 finally
  1026.                 {
  1027.                     IEnumerator<string> enumerator2;
  1028.                     if (enumerator2 != null)
  1029.                     {
  1030.                         enumerator2.Dispose();
  1031.                     }
  1032.                 }
  1033.                 int num3 = 0;
  1034.                 try
  1035.                 {
  1036.                     foreach (string text9 in this.settings.Blocks[blockId].Apps.Distinct<string>())
  1037.                     {
  1038.                         int num4 = 0;
  1039.                         string text10 = text9.Replace("%", "\\%").Replace("*", "%").Replace("'", "''");
  1040.                         string text11 = null;
  1041.                         if (text10.StartsWith("file:"))
  1042.                         {
  1043.                             string text12 = text10.Substring(5).ToLowerInvariant();
  1044.                             text11 = string.Concat(new string[]
  1045.                             {
  1046.                                 "SELECT SUM(seconds) FROM statsApp WHERE (date >= ",
  1047.                                 text,
  1048.                                 " AND date < ",
  1049.                                 text2,
  1050.                                 ") AND user = '",
  1051.                                 text3,
  1052.                                 "' AND file = '",
  1053.                                 text12,
  1054.                                 "'"
  1055.                             });
  1056.                         }
  1057.                         else if (text10.StartsWith("win10:"))
  1058.                         {
  1059.                             string text13 = text10.Substring(6).ToLowerInvariant();
  1060.                             text11 = string.Concat(new string[]
  1061.                             {
  1062.                                 "SELECT SUM(seconds) FROM statsApp WHERE (date >= ",
  1063.                                 text,
  1064.                                 " AND date < ",
  1065.                                 text2,
  1066.                                 ") AND user = '",
  1067.                                 text3,
  1068.                                 "' AND (file LIKE '%/windowsapps/%",
  1069.                                 text13,
  1070.                                 "' OR file LIKE '%/systemapps/%",
  1071.                                 text13,
  1072.                                 "')"
  1073.                             });
  1074.                         }
  1075.                         else if (text10.StartsWith("folder:"))
  1076.                         {
  1077.                             string text14 = text10.Substring(7).ToLowerInvariant();
  1078.                             text11 = string.Concat(new string[]
  1079.                             {
  1080.                                 "SELECT SUM(seconds) FROM statsApp WHERE (date >= ",
  1081.                                 text,
  1082.                                 " AND date < ",
  1083.                                 text2,
  1084.                                 ") AND user = '",
  1085.                                 text3,
  1086.                                 "' AND file LIKE '",
  1087.                                 text14,
  1088.                                 "%' ESCAPE '\\'"
  1089.                             });
  1090.                         }
  1091.                         else if (text10.StartsWith("title:"))
  1092.                         {
  1093.                             string text15 = text10.Substring(6).ToLowerInvariant();
  1094.                             text11 = string.Concat(new string[]
  1095.                             {
  1096.                                 "SELECT SUM(seconds) FROM statsTitle WHERE (date >= ",
  1097.                                 text,
  1098.                                 " AND date < ",
  1099.                                 text2,
  1100.                                 ") AND user = '",
  1101.                                 text3,
  1102.                                 "' AND title LIKE '",
  1103.                                 text15,
  1104.                                 "' ESCAPE '\\'"
  1105.                             });
  1106.                         }
  1107.                         if (text11 != null && int.TryParse(new SQLiteCommand(text11, this.dbHelper).ExecuteScalar().ToString(), out num4))
  1108.                         {
  1109.                             num3 += num4;
  1110.                         }
  1111.                     }
  1112.                 }
  1113.                 finally
  1114.                 {
  1115.                     IEnumerator<string> enumerator3;
  1116.                     if (enumerator3 != null)
  1117.                     {
  1118.                         enumerator3.Dispose();
  1119.                     }
  1120.                 }
  1121.                 int num5 = 0;
  1122.                 try
  1123.                 {
  1124.                     foreach (string text16 in list)
  1125.                     {
  1126.                         int num6 = 0;
  1127.                         string text17 = text16.Replace("%", "\\%").Replace("*", "%").Replace("'", "''");
  1128.                         string text18;
  1129.                         if (!text17.Contains("/"))
  1130.                         {
  1131.                             text18 = string.Concat(new string[]
  1132.                             {
  1133.                                 "SELECT SUM(seconds) FROM stats WHERE (date >= ",
  1134.                                 text,
  1135.                                 " AND date < ",
  1136.                                 text2,
  1137.                                 ") AND user = '",
  1138.                                 text3,
  1139.                                 "' AND (domain = '",
  1140.                                 text17,
  1141.                                 "' OR domain LIKE '%.",
  1142.                                 text17,
  1143.                                 "' ESCAPE '\\' OR domain LIKE '",
  1144.                                 text17,
  1145.                                 "/%' ESCAPE '\\' OR domain LIKE '%.",
  1146.                                 text17,
  1147.                                 "/%' ESCAPE '\\')"
  1148.                             });
  1149.                         }
  1150.                         else
  1151.                         {
  1152.                             text18 = string.Concat(new string[]
  1153.                             {
  1154.                                 "SELECT SUM(seconds) FROM stats WHERE (date >= ",
  1155.                                 text,
  1156.                                 " AND date < ",
  1157.                                 text2,
  1158.                                 ") AND user = '",
  1159.                                 text3,
  1160.                                 "' AND (domain = '",
  1161.                                 text17,
  1162.                                 "' OR domain LIKE '%.",
  1163.                                 text17,
  1164.                                 "%' ESCAPE '\\')"
  1165.                             });
  1166.                         }
  1167.                         if (text18 != null && int.TryParse(new SQLiteCommand(text18, this.dbBrowser).ExecuteScalar().ToString(), out num6))
  1168.                         {
  1169.                             num5 += num6;
  1170.                         }
  1171.                     }
  1172.                 }
  1173.                 finally
  1174.                 {
  1175.                     List<string>.Enumerator enumerator4;
  1176.                     ((IDisposable)enumerator4).Dispose();
  1177.                 }
  1178.                 int num7 = 0;
  1179.                 int num8 = 0;
  1180.                 int num9 = 0;
  1181.                 if (Operators.CompareString(this.settings.Settings.StatsStrict, "true", false) == 0)
  1182.                 {
  1183.                     try
  1184.                     {
  1185.                         foreach (string text19 in this.settings.Blocks[blockId].Web.Distinct<string>())
  1186.                         {
  1187.                             int num10 = 0;
  1188.                             string text20 = text19.Replace("%", "\\%").Replace("*", "%").Replace("'", "''");
  1189.                             string text21;
  1190.                             if (!text20.Contains("/"))
  1191.                             {
  1192.                                 text21 = string.Concat(new string[]
  1193.                                 {
  1194.                                     "SELECT SUM(seconds) FROM statsStrict WHERE (date >= ",
  1195.                                     text,
  1196.                                     " AND date < ",
  1197.                                     text2,
  1198.                                     ") AND user = '",
  1199.                                     text3,
  1200.                                     "' AND (domain = '",
  1201.                                     text20,
  1202.                                     "' OR domain LIKE '%.",
  1203.                                     text20,
  1204.                                     "' ESCAPE '\\' OR domain LIKE '",
  1205.                                     text20,
  1206.                                     "/%' ESCAPE '\\' OR domain LIKE '%.",
  1207.                                     text20,
  1208.                                     "/%' ESCAPE '\\')"
  1209.                                 });
  1210.                             }
  1211.                             else
  1212.                             {
  1213.                                 text21 = string.Concat(new string[]
  1214.                                 {
  1215.                                     "SELECT SUM(seconds) FROM statsStrict WHERE (date >= ",
  1216.                                     text,
  1217.                                     " AND date < ",
  1218.                                     text2,
  1219.                                     ") AND user = '",
  1220.                                     text3,
  1221.                                     "' AND (domain = '",
  1222.                                     text20,
  1223.                                     "' OR domain LIKE '%.",
  1224.                                     text20,
  1225.                                     "%' ESCAPE '\\')"
  1226.                                 });
  1227.                             }
  1228.                             if (text21 != null && int.TryParse(new SQLiteCommand(text21, this.dbBrowser).ExecuteScalar().ToString(), out num10))
  1229.                             {
  1230.                                 num7 += num10;
  1231.                             }
  1232.                         }
  1233.                     }
  1234.                     finally
  1235.                     {
  1236.                         IEnumerator<string> enumerator5;
  1237.                         if (enumerator5 != null)
  1238.                         {
  1239.                             enumerator5.Dispose();
  1240.                         }
  1241.                     }
  1242.                     try
  1243.                     {
  1244.                         foreach (string text22 in this.settings.Blocks[blockId].Apps.Distinct<string>())
  1245.                         {
  1246.                             int num11 = 0;
  1247.                             int num12 = 0;
  1248.                             string text23 = text22.Replace("%", "\\%").Replace("*", "%").Replace("'", "''");
  1249.                             string text24 = null;
  1250.                             string text25 = null;
  1251.                             if (text23.StartsWith("file:"))
  1252.                             {
  1253.                                 string text26 = text23.Substring(5).ToLowerInvariant();
  1254.                                 text24 = string.Concat(new string[]
  1255.                                 {
  1256.                                     "SELECT SUM(seconds) FROM statsAppStrict WHERE (date >= ",
  1257.                                     text,
  1258.                                     " AND date < ",
  1259.                                     text2,
  1260.                                     ") AND user = '",
  1261.                                     text3,
  1262.                                     "' AND file = '",
  1263.                                     text26,
  1264.                                     "'"
  1265.                                 });
  1266.                             }
  1267.                             else if (text23.StartsWith("win10:"))
  1268.                             {
  1269.                                 string text27 = text23.Substring(6).ToLowerInvariant();
  1270.                                 text24 = string.Concat(new string[]
  1271.                                 {
  1272.                                     "SELECT SUM(seconds) FROM statsAppStrict WHERE (date >= ",
  1273.                                     text,
  1274.                                     " AND date < ",
  1275.                                     text2,
  1276.                                     ") AND user = '",
  1277.                                     text3,
  1278.                                     "' AND (file LIKE '%/windowsapps/%",
  1279.                                     text27,
  1280.                                     "' OR file LIKE '%/systemapps/%",
  1281.                                     text27,
  1282.                                     "')"
  1283.                                 });
  1284.                             }
  1285.                             else if (text23.StartsWith("folder:"))
  1286.                             {
  1287.                                 string text28 = text23.Substring(7).ToLowerInvariant();
  1288.                                 text24 = string.Concat(new string[]
  1289.                                 {
  1290.                                     "SELECT SUM(seconds) FROM statsAppStrict WHERE (date >= ",
  1291.                                     text,
  1292.                                     " AND date < ",
  1293.                                     text2,
  1294.                                     ") AND user = '",
  1295.                                     text3,
  1296.                                     "' AND file LIKE '",
  1297.                                     text28,
  1298.                                     "%' ESCAPE '\\'"
  1299.                                 });
  1300.                             }
  1301.                             else if (text23.StartsWith("title:"))
  1302.                             {
  1303.                                 string text29 = text23.Substring(6).ToLowerInvariant();
  1304.                                 text24 = string.Concat(new string[]
  1305.                                 {
  1306.                                     "SELECT SUM(seconds) FROM statsTitleStrict WHERE (date >= ",
  1307.                                     text,
  1308.                                     " AND date < ",
  1309.                                     text2,
  1310.                                     ") AND user = '",
  1311.                                     text3,
  1312.                                     "' AND title LIKE '",
  1313.                                     text29,
  1314.                                     "' ESCAPE '\\'"
  1315.                                 });
  1316.                                 text25 = string.Concat(new string[]
  1317.                                 {
  1318.                                     "SELECT SUM(seconds) FROM statsTitleStrict WHERE (date >= ",
  1319.                                     text,
  1320.                                     " AND date < ",
  1321.                                     text2,
  1322.                                     ") AND user = '",
  1323.                                     text3,
  1324.                                     "' AND title LIKE '",
  1325.                                     text29,
  1326.                                     "' ESCAPE '\\'"
  1327.                                 });
  1328.                             }
  1329.                             if (text24 != null && int.TryParse(new SQLiteCommand(text24, this.dbHelper).ExecuteScalar().ToString(), out num11))
  1330.                             {
  1331.                                 num8 += num11;
  1332.                             }
  1333.                             if (text25 != null && int.TryParse(new SQLiteCommand(text24, this.dbBrowser).ExecuteScalar().ToString(), out num12))
  1334.                             {
  1335.                                 num8 += num12;
  1336.                             }
  1337.                         }
  1338.                     }
  1339.                     finally
  1340.                     {
  1341.                         IEnumerator<string> enumerator6;
  1342.                         if (enumerator6 != null)
  1343.                         {
  1344.                             enumerator6.Dispose();
  1345.                         }
  1346.                     }
  1347.                     try
  1348.                     {
  1349.                         foreach (string text30 in list)
  1350.                         {
  1351.                             int num13 = 0;
  1352.                             string text31 = text30.Replace("%", "\\%").Replace("*", "%").Replace("'", "''");
  1353.                             string text32;
  1354.                             if (!text31.Contains("/"))
  1355.                             {
  1356.                                 text32 = string.Concat(new string[]
  1357.                                 {
  1358.                                     "SELECT SUM(seconds) FROM statsStrict WHERE (date >= ",
  1359.                                     text,
  1360.                                     " AND date < ",
  1361.                                     text2,
  1362.                                     ") AND user = '",
  1363.                                     text3,
  1364.                                     "' AND (domain = '",
  1365.                                     text31,
  1366.                                     "' OR domain LIKE '%.",
  1367.                                     text31,
  1368.                                     "' ESCAPE '\\' OR domain LIKE '",
  1369.                                     text31,
  1370.                                     "/%' ESCAPE '\\' OR domain LIKE '%.",
  1371.                                     text31,
  1372.                                     "/%' ESCAPE '\\')"
  1373.                                 });
  1374.                             }
  1375.                             else
  1376.                             {
  1377.                                 text32 = string.Concat(new string[]
  1378.                                 {
  1379.                                     "SELECT SUM(seconds) FROM statsStrict WHERE (date >= ",
  1380.                                     text,
  1381.                                     " AND date < ",
  1382.                                     text2,
  1383.                                     ") AND user = '",
  1384.                                     text3,
  1385.                                     "' AND (domain = '",
  1386.                                     text31,
  1387.                                     "' OR domain LIKE '%.",
  1388.                                     text31,
  1389.                                     "%' ESCAPE '\\')"
  1390.                                 });
  1391.                             }
  1392.                             if (text32 != null && int.TryParse(new SQLiteCommand(text32, this.dbBrowser).ExecuteScalar().ToString(), out num13))
  1393.                             {
  1394.                                 num9 += num13;
  1395.                             }
  1396.                         }
  1397.                     }
  1398.                     finally
  1399.                     {
  1400.                         List<string>.Enumerator enumerator7;
  1401.                         ((IDisposable)enumerator7).Dispose();
  1402.                     }
  1403.                 }
  1404.                 int num14 = num - num5 + num7 - num9;
  1405.                 if (num14 < 0)
  1406.                 {
  1407.                     num14 = 0;
  1408.                 }
  1409.                 return num14 + num3 + num8;
  1410.             }
  1411.         }
  1412.  
  1413.         private int GetSecondsSpentOnAnything(DateTime startTime, DateTime endTime)
  1414.         {
  1415.             string text = startTime.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString("F0");
  1416.             string text2 = endTime.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString("F0");
  1417.             string text3 = Environment.UserName.Replace("'", "''");
  1418.             int result = 0;
  1419.             int.TryParse(new SQLiteCommand(string.Concat(new string[]
  1420.             {
  1421.                 "SELECT SUM(seconds) FROM statsApp WHERE (date >= ",
  1422.                 text,
  1423.                 " AND date < ",
  1424.                 text2,
  1425.                 ") AND user = '",
  1426.                 text3,
  1427.                 "'"
  1428.             }), this.dbHelper).ExecuteScalar().ToString(), out result);
  1429.             return result;
  1430.         }
  1431.  
  1432.         public void WriteSettingsToDatabase()
  1433.         {
  1434.             try
  1435.             {
  1436.                 new SQLiteCommand("INSERT OR REPLACE INTO settings (key, value) VALUES ('settings', @settings)", this.dbApp)
  1437.                 {
  1438.                     Parameters =
  1439.                     {
  1440.                         new SQLiteParameter("@settings", JsonConvert.SerializeObject(this.settings))
  1441.                     }
  1442.                 }.ExecuteNonQuery();
  1443.             }
  1444.             catch (Exception e)
  1445.             {
  1446.                 this.WriteError(e);
  1447.                 Interaction.MsgBox("Your settings could not be saved. Try closing and reopening the Cold Turkey Blocker window.", MsgBoxStyle.Exclamation, "Error Saving Settings");
  1448.             }
  1449.         }
  1450.  
  1451.         private void SysTray_MouseClick(object sender, MouseEventArgs e)
  1452.         {
  1453.             if (e.Button == MouseButtons.Right)
  1454.             {
  1455.                 this.trayMenu.Enabled = true;
  1456.                 return;
  1457.             }
  1458.             if (e.Button == MouseButtons.Left)
  1459.             {
  1460.                 this.OpenWindow(true);
  1461.             }
  1462.         }
  1463.  
  1464.         private void TrayAbout_Click(object sender, EventArgs e)
  1465.         {
  1466.             this.ShowInfo();
  1467.         }
  1468.  
  1469.         private void TrayOpen_Click(object sender, EventArgs e)
  1470.         {
  1471.             this.OpenWindow(true);
  1472.         }
  1473.  
  1474.         public void OpenWindow(bool refresh)
  1475.         {
  1476.             base.ShowInTaskbar = true;
  1477.             this.tray.Visible = false;
  1478.             base.Show();
  1479.             base.Activate();
  1480.             if (refresh)
  1481.             {
  1482.                 this.web.Refresh();
  1483.             }
  1484.         }
  1485.  
  1486.         [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
  1487.         private void TrayExit_Click(object sender, EventArgs e)
  1488.         {
  1489.             this.DisposeOpenObjects();
  1490.             ProjectData.EndApp();
  1491.         }
  1492.  
  1493.         private void ColdTurkey_FormClosing(object sender, FormClosingEventArgs e)
  1494.         {
  1495.             if (e.CloseReason == CloseReason.UserClosing & Operators.CompareString(this.settings.Settings.CloseToTray, "true", false) == 0)
  1496.             {
  1497.                 base.ShowInTaskbar = false;
  1498.                 base.Hide();
  1499.                 this.tray.Visible = true;
  1500.                 e.Cancel = true;
  1501.                 return;
  1502.             }
  1503.             this.DisposeOpenObjects();
  1504.         }
  1505.  
  1506.         private void ShowInfo()
  1507.         {
  1508.             Interaction.MsgBox("Cold Turkey Blocker\r\nVersion " + this.currentVersion.ToString("0.00") + "\r\nhttps://getcoldturkey.com\r\n\r\nCold Turkey Blocker temporarily blocks websites and applications to help you get work done.\r\n\r\nCopyright (c) 2020. Cold Turkey Software Inc.", MsgBoxStyle.OkOnly, "About Cold Turkey Blocker");
  1509.         }
  1510.  
  1511.         public object SendStats(string chartId, string chartOptions, string chartUsers, double startDateIn, double endDateIn)
  1512.         {
  1513.             List<Series> list = new List<Series>();
  1514.             DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(startDateIn);
  1515.             double num = startDateIn + TimeZoneInfo.Local.GetUtcOffset(dateTime).TotalSeconds;
  1516.             DateTime dateTime2 = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(endDateIn);
  1517.             double num2 = endDateIn + TimeZoneInfo.Local.GetUtcOffset(dateTime2).TotalSeconds;
  1518.             string text = num.ToString("F0");
  1519.             string text2 = num2.ToString("F0");
  1520.             try
  1521.             {
  1522.                 uint num3 = <PrivateImplementationDetails>.ComputeStringHash(chartId);
  1523.                 if (num3 <= 1160245379U)
  1524.                 {
  1525.                     if (num3 <= 435774502U)
  1526.                     {
  1527.                         if (num3 != 164560180U)
  1528.                         {
  1529.                             if (num3 != 435774502U)
  1530.                             {
  1531.                                 goto IL_1AD1;
  1532.                             }
  1533.                             if (Operators.CompareString(chartId, "web-top5", false) != 0)
  1534.                             {
  1535.                                 goto IL_1AD1;
  1536.                             }
  1537.                             string text3 = "";
  1538.                             string text4 = "";
  1539.                             if (Operators.CompareString(chartUsers, "all", false) != 0)
  1540.                             {
  1541.                                 text4 = " AND user = '" + chartUsers.Replace("'", "''") + "'";
  1542.                             }
  1543.                             if (Operators.CompareString(chartOptions, "all", false) != 0)
  1544.                             {
  1545.                                 List<string> values = new List<string>(this.settings.Blocks[chartOptions].Web.Where((ColdTurkey._Closure$__.$I42-2 == null) ? (ColdTurkey._Closure$__.$I42-2 = ((string entry) => !(entry.Contains("*") | entry.Contains("/")))) : ColdTurkey._Closure$__.$I42-2).Select((ColdTurkey._Closure$__.$I42-3 == null) ? (ColdTurkey._Closure$__.$I42-3 = ((string entry) => entry.Replace("'", "''"))) : ColdTurkey._Closure$__.$I42-3));
  1546.                                 text3 = " AND fdomain IN ('" + string.Join("','", values) + "')";
  1547.                             }
  1548.                             List<string> list2 = new List<string>();
  1549.                             SQLiteDataReader sqliteDataReader = new SQLiteCommand(string.Concat(new string[]
  1550.                             {
  1551.                                 "SELECT SUBSTR(domain, 0, IFNULL(NULLIF(INSTR(domain, '/'),0),LENGTH(domain)+1)) as fdomain FROM stats WHERE (date >= ",
  1552.                                 text,
  1553.                                 " AND date <= ",
  1554.                                 text2,
  1555.                                 ")",
  1556.                                 text4,
  1557.                                 text3,
  1558.                                 " GROUP BY fdomain ORDER BY SUM(seconds) DESC LIMIT 5"
  1559.                             }), this.dbBrowser).ExecuteReader();
  1560.                             while (sqliteDataReader.Read())
  1561.                             {
  1562.                                 list2.Add(sqliteDataReader["fdomain"].ToString());
  1563.                             }
  1564.                             try
  1565.                             {
  1566.                                 foreach (string text5 in list2)
  1567.                                 {
  1568.                                     Series series = new Series();
  1569.                                     double num4 = num;
  1570.                                     double num5 = num2;
  1571.                                     for (double num6 = num4; num6 <= num5; num6 += 86400.0)
  1572.                                     {
  1573.                                         List<double[]> data = series.Data;
  1574.                                         double[] array = new double[2];
  1575.                                         array[0] = num6 * 1000.0;
  1576.                                         data.Add(array);
  1577.                                     }
  1578.                                     SQLiteDataReader sqliteDataReader2 = new SQLiteCommand(string.Concat(new string[]
  1579.                                     {
  1580.                                         "SELECT date, SUM(seconds) AS fsum FROM stats WHERE (date >= ",
  1581.                                         text,
  1582.                                         " AND date <= ",
  1583.                                         text2,
  1584.                                         ")",
  1585.                                         text4,
  1586.                                         " AND SUBSTR(domain, 0, IFNULL(NULLIF(INSTR(domain, '/'),0),LENGTH(domain)+1)) = '",
  1587.                                         text5.Replace("'", "''"),
  1588.                                         "' GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  1589.                                     }), this.dbBrowser).ExecuteReader();
  1590.                                     while (sqliteDataReader2.Read())
  1591.                                     {
  1592.                                         ColdTurkey._Closure$__42-2 CS$<>8__locals1 = new ColdTurkey._Closure$__42-2(CS$<>8__locals1);
  1593.                                         CS$<>8__locals1.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader2["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader2["date"])) % 86400.0;
  1594.                                         int num7 = series.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals1.$VB$Local_midnight * 1000.0);
  1595.                                         if (num7 >= 0)
  1596.                                         {
  1597.                                             series.Data[num7] = new double[]
  1598.                                             {
  1599.                                                 CS$<>8__locals1.$VB$Local_midnight * 1000.0,
  1600.                                                 Math.Round(Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader2["fsum"])) / 60.0, 2)
  1601.                                             };
  1602.                                         }
  1603.                                     }
  1604.                                     series.Label = text5;
  1605.                                     list.Add(series);
  1606.                                 }
  1607.                                 goto IL_1AD1;
  1608.                             }
  1609.                             finally
  1610.                             {
  1611.                                 List<string>.Enumerator enumerator;
  1612.                                 ((IDisposable)enumerator).Dispose();
  1613.                             }
  1614.                         }
  1615.                         else
  1616.                         {
  1617.                             if (Operators.CompareString(chartId, "app-search-title", false) != 0)
  1618.                             {
  1619.                                 goto IL_1AD1;
  1620.                             }
  1621.                             goto IL_17D9;
  1622.                         }
  1623.                     }
  1624.                     else if (num3 != 770011565U)
  1625.                     {
  1626.                         if (num3 != 1160245379U)
  1627.                         {
  1628.                             goto IL_1AD1;
  1629.                         }
  1630.                         if (Operators.CompareString(chartId, "app-top10", false) != 0)
  1631.                         {
  1632.                             goto IL_1AD1;
  1633.                         }
  1634.                         goto IL_11CA;
  1635.                     }
  1636.                     else
  1637.                     {
  1638.                         if (Operators.CompareString(chartId, "app-top5", false) != 0)
  1639.                         {
  1640.                             goto IL_1AD1;
  1641.                         }
  1642.                         goto IL_EB6;
  1643.                     }
  1644.                 }
  1645.                 else if (num3 <= 1732731101U)
  1646.                 {
  1647.                     if (num3 != 1346409049U)
  1648.                     {
  1649.                         if (num3 != 1732731101U)
  1650.                         {
  1651.                             goto IL_1AD1;
  1652.                         }
  1653.                         if (Operators.CompareString(chartId, "app-blocked", false) != 0)
  1654.                         {
  1655.                             goto IL_1AD1;
  1656.                         }
  1657.                         Series series2 = new Series();
  1658.                         double num8 = num;
  1659.                         double num9 = num2;
  1660.                         for (double num10 = num8; num10 <= num9; num10 += 86400.0)
  1661.                         {
  1662.                             List<double[]> data2 = series2.Data;
  1663.                             double[] array2 = new double[2];
  1664.                             array2[0] = num10 * 1000.0;
  1665.                             data2.Add(array2);
  1666.                         }
  1667.                         SQLiteDataReader sqliteDataReader3 = new SQLiteCommand(string.Concat(new string[]
  1668.                         {
  1669.                             "SELECT date, COUNT(*) FROM statsBlocked WHERE (date >= ",
  1670.                             text,
  1671.                             " AND date <= ",
  1672.                             text2,
  1673.                             ") GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  1674.                         }), this.dbHelper).ExecuteReader();
  1675.                         while (sqliteDataReader3.Read())
  1676.                         {
  1677.                             ColdTurkey._Closure$__42-1 CS$<>8__locals2 = new ColdTurkey._Closure$__42-1(CS$<>8__locals2);
  1678.                             CS$<>8__locals2.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader3["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader3["date"])) % 86400.0;
  1679.                             int num11 = series2.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals2.$VB$Local_midnight * 1000.0);
  1680.                             if (num11 >= 0)
  1681.                             {
  1682.                                 series2.Data[num11] = new double[]
  1683.                                 {
  1684.                                     CS$<>8__locals2.$VB$Local_midnight * 1000.0,
  1685.                                     Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader3["COUNT(*)"]))
  1686.                                 };
  1687.                             }
  1688.                         }
  1689.                         series2.Label = "Applications Blocked";
  1690.                         list.Add(series2);
  1691.                         goto IL_1AD1;
  1692.                     }
  1693.                     else
  1694.                     {
  1695.                         if (Operators.CompareString(chartId, "app-search-name", false) != 0)
  1696.                         {
  1697.                             goto IL_1AD1;
  1698.                         }
  1699.                         goto IL_14DE;
  1700.                     }
  1701.                 }
  1702.                 else if (num3 != 1794203764U)
  1703.                 {
  1704.                     if (num3 != 1906460134U)
  1705.                     {
  1706.                         if (num3 != 4155674659U)
  1707.                         {
  1708.                             goto IL_1AD1;
  1709.                         }
  1710.                         if (Operators.CompareString(chartId, "web-search-domain", false) != 0)
  1711.                         {
  1712.                             goto IL_1AD1;
  1713.                         }
  1714.                         goto IL_ACB;
  1715.                     }
  1716.                     else if (Operators.CompareString(chartId, "web-top10", false) != 0)
  1717.                     {
  1718.                         goto IL_1AD1;
  1719.                     }
  1720.                 }
  1721.                 else
  1722.                 {
  1723.                     if (Operators.CompareString(chartId, "web-blocked", false) != 0)
  1724.                     {
  1725.                         goto IL_1AD1;
  1726.                     }
  1727.                     Series series3 = new Series();
  1728.                     double num12 = num;
  1729.                     double num13 = num2;
  1730.                     for (double num14 = num12; num14 <= num13; num14 += 86400.0)
  1731.                     {
  1732.                         List<double[]> data3 = series3.Data;
  1733.                         double[] array3 = new double[2];
  1734.                         array3[0] = num14 * 1000.0;
  1735.                         data3.Add(array3);
  1736.                     }
  1737.                     SQLiteDataReader sqliteDataReader4 = new SQLiteCommand(string.Concat(new string[]
  1738.                     {
  1739.                         "SELECT date, COUNT(*) FROM statsBlocked WHERE (date >= ",
  1740.                         text,
  1741.                         " AND date <= ",
  1742.                         text2,
  1743.                         ") GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  1744.                     }), this.dbBrowser).ExecuteReader();
  1745.                     while (sqliteDataReader4.Read())
  1746.                     {
  1747.                         ColdTurkey._Closure$__42-0 CS$<>8__locals3 = new ColdTurkey._Closure$__42-0(CS$<>8__locals3);
  1748.                         CS$<>8__locals3.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader4["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader4["date"])) % 86400.0;
  1749.                         int num15 = series3.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals3.$VB$Local_midnight * 1000.0);
  1750.                         if (num15 >= 0)
  1751.                         {
  1752.                             series3.Data[num15] = new double[]
  1753.                             {
  1754.                                 CS$<>8__locals3.$VB$Local_midnight * 1000.0,
  1755.                                 Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader4["COUNT(*)"]))
  1756.                             };
  1757.                         }
  1758.                     }
  1759.                     series3.Label = "Websites Blocked";
  1760.                     list.Add(series3);
  1761.                     goto IL_1AD1;
  1762.                 }
  1763.                 string text6 = "";
  1764.                 string text7 = "";
  1765.                 if (Operators.CompareString(chartUsers, "all", false) != 0)
  1766.                 {
  1767.                     text7 = " AND user = '" + chartUsers.Replace("'", "''") + "'";
  1768.                 }
  1769.                 if (Operators.CompareString(chartOptions, "all", false) != 0)
  1770.                 {
  1771.                     List<string> values2 = new List<string>(this.settings.Blocks[chartOptions].Web.Where((ColdTurkey._Closure$__.$I42-5 == null) ? (ColdTurkey._Closure$__.$I42-5 = ((string entry) => !(entry.Contains("*") | entry.Contains("/")))) : ColdTurkey._Closure$__.$I42-5).Select((ColdTurkey._Closure$__.$I42-6 == null) ? (ColdTurkey._Closure$__.$I42-6 = ((string entry) => entry.Replace("'", "''"))) : ColdTurkey._Closure$__.$I42-6));
  1772.                     text6 = " AND fdomain IN ('" + string.Join("','", values2) + "')";
  1773.                 }
  1774.                 List<string> list3 = new List<string>();
  1775.                 SQLiteDataReader sqliteDataReader5 = new SQLiteCommand(string.Concat(new string[]
  1776.                 {
  1777.                     "SELECT SUBSTR(domain, 0, IFNULL(NULLIF(INSTR(domain, '/'),0),LENGTH(domain)+1)) as fdomain FROM stats WHERE (date >= ",
  1778.                     text,
  1779.                     " AND date <= ",
  1780.                     text2,
  1781.                     ")",
  1782.                     text7,
  1783.                     text6,
  1784.                     " GROUP BY fdomain ORDER BY SUM(seconds) DESC LIMIT 10"
  1785.                 }), this.dbBrowser).ExecuteReader();
  1786.                 while (sqliteDataReader5.Read())
  1787.                 {
  1788.                     list3.Add(sqliteDataReader5["fdomain"].ToString());
  1789.                 }
  1790.                 try
  1791.                 {
  1792.                     foreach (string text8 in list3)
  1793.                     {
  1794.                         Series series4 = new Series();
  1795.                         double num16 = num;
  1796.                         double num17 = num2;
  1797.                         for (double num18 = num16; num18 <= num17; num18 += 86400.0)
  1798.                         {
  1799.                             List<double[]> data4 = series4.Data;
  1800.                             double[] array4 = new double[2];
  1801.                             array4[0] = num18 * 1000.0;
  1802.                             data4.Add(array4);
  1803.                         }
  1804.                         SQLiteDataReader sqliteDataReader6 = new SQLiteCommand(string.Concat(new string[]
  1805.                         {
  1806.                             "SELECT date, SUM(seconds) AS fsum FROM stats WHERE (date >= ",
  1807.                             text,
  1808.                             " AND date <= ",
  1809.                             text2,
  1810.                             ")",
  1811.                             text7,
  1812.                             " AND SUBSTR(domain, 0, IFNULL(NULLIF(INSTR(domain, '/'),0),LENGTH(domain)+1)) = '",
  1813.                             text8.Replace("'", "''"),
  1814.                             "' GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  1815.                         }), this.dbBrowser).ExecuteReader();
  1816.                         while (sqliteDataReader6.Read())
  1817.                         {
  1818.                             ColdTurkey._Closure$__42-3 CS$<>8__locals4 = new ColdTurkey._Closure$__42-3(CS$<>8__locals4);
  1819.                             CS$<>8__locals4.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader6["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader6["date"])) % 86400.0;
  1820.                             int num19 = series4.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals4.$VB$Local_midnight * 1000.0);
  1821.                             if (num19 >= 0)
  1822.                             {
  1823.                                 series4.Data[num19] = new double[]
  1824.                                 {
  1825.                                     CS$<>8__locals4.$VB$Local_midnight * 1000.0,
  1826.                                     Math.Round(Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader6["fsum"])) / 60.0, 2)
  1827.                                 };
  1828.                             }
  1829.                         }
  1830.                         series4.Label = text8;
  1831.                         list.Add(series4);
  1832.                     }
  1833.                     goto IL_1AD1;
  1834.                 }
  1835.                 finally
  1836.                 {
  1837.                     List<string>.Enumerator enumerator2;
  1838.                     ((IDisposable)enumerator2).Dispose();
  1839.                 }
  1840.                 IL_ACB:
  1841.                 string text9 = "";
  1842.                 if (Operators.CompareString(chartUsers, "all", false) != 0)
  1843.                 {
  1844.                     text9 = " AND user = '" + chartUsers.Replace("'", "''") + "'";
  1845.                 }
  1846.                 if (chartOptions == null | Operators.CompareString(chartOptions, "", false) == 0)
  1847.                 {
  1848.                     Series series5 = new Series();
  1849.                     double num20 = num;
  1850.                     double num21 = num2;
  1851.                     for (double num22 = num20; num22 <= num21; num22 += 86400.0)
  1852.                     {
  1853.                         List<double[]> data5 = series5.Data;
  1854.                         double[] array5 = new double[2];
  1855.                         array5[0] = num22 * 1000.0;
  1856.                         data5.Add(array5);
  1857.                     }
  1858.                     series5.Label = "";
  1859.                     list.Add(series5);
  1860.                     goto IL_1AD1;
  1861.                 }
  1862.                 List<string> list4 = new List<string>();
  1863.                 SQLiteCommand sqliteCommand;
  1864.                 if (chartOptions.StartsWith("file://"))
  1865.                 {
  1866.                     sqliteCommand = new SQLiteCommand(string.Concat(new string[]
  1867.                     {
  1868.                         "SELECT domain as fdomain FROM stats WHERE (date >= ",
  1869.                         text,
  1870.                         " AND date <= ",
  1871.                         text2,
  1872.                         ")",
  1873.                         text9,
  1874.                         " AND fdomain LIKE '%",
  1875.                         chartOptions.Replace("'", "''"),
  1876.                         "%' GROUP BY fdomain ORDER BY SUM(seconds) DESC LIMIT 10"
  1877.                     }), this.dbBrowser);
  1878.                 }
  1879.                 else
  1880.                 {
  1881.                     sqliteCommand = new SQLiteCommand(string.Concat(new string[]
  1882.                     {
  1883.                         "SELECT SUBSTR(domain, 0, IFNULL(NULLIF(INSTR(domain, '/'),0),LENGTH(domain)+1)) as fdomain FROM stats WHERE (date >= ",
  1884.                         text,
  1885.                         " AND date <= ",
  1886.                         text2,
  1887.                         ")",
  1888.                         text9,
  1889.                         " AND fdomain LIKE '%",
  1890.                         chartOptions.Replace("'", "''"),
  1891.                         "%' GROUP BY fdomain ORDER BY SUM(seconds) DESC LIMIT 10"
  1892.                     }), this.dbBrowser);
  1893.                 }
  1894.                 SQLiteDataReader sqliteDataReader7 = sqliteCommand.ExecuteReader();
  1895.                 while (sqliteDataReader7.Read())
  1896.                 {
  1897.                     list4.Add(sqliteDataReader7["fdomain"].ToString());
  1898.                 }
  1899.                 try
  1900.                 {
  1901.                     foreach (string text10 in list4)
  1902.                     {
  1903.                         Series series6 = new Series();
  1904.                         double num23 = num;
  1905.                         double num24 = num2;
  1906.                         for (double num25 = num23; num25 <= num24; num25 += 86400.0)
  1907.                         {
  1908.                             List<double[]> data6 = series6.Data;
  1909.                             double[] array6 = new double[2];
  1910.                             array6[0] = num25 * 1000.0;
  1911.                             data6.Add(array6);
  1912.                         }
  1913.                         SQLiteCommand sqliteCommand2;
  1914.                         if (chartOptions.StartsWith("file://"))
  1915.                         {
  1916.                             sqliteCommand2 = new SQLiteCommand(string.Concat(new string[]
  1917.                             {
  1918.                                 "SELECT date, SUM(seconds) AS fsum FROM stats WHERE (date >= ",
  1919.                                 text,
  1920.                                 " AND date <= ",
  1921.                                 text2,
  1922.                                 ")",
  1923.                                 text9,
  1924.                                 " AND domain = '",
  1925.                                 text10.Replace("'", "''"),
  1926.                                 "' GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  1927.                             }), this.dbBrowser);
  1928.                         }
  1929.                         else
  1930.                         {
  1931.                             sqliteCommand2 = new SQLiteCommand(string.Concat(new string[]
  1932.                             {
  1933.                                 "SELECT date, SUM(seconds) AS fsum FROM stats WHERE (date >= ",
  1934.                                 text,
  1935.                                 " AND date <= ",
  1936.                                 text2,
  1937.                                 ")",
  1938.                                 text9,
  1939.                                 " AND SUBSTR(domain, 0, IFNULL(NULLIF(INSTR(domain, '/'),0),LENGTH(domain)+1)) = '",
  1940.                                 text10.Replace("'", "''"),
  1941.                                 "' GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  1942.                             }), this.dbBrowser);
  1943.                         }
  1944.                         SQLiteDataReader sqliteDataReader8 = sqliteCommand2.ExecuteReader();
  1945.                         while (sqliteDataReader8.Read())
  1946.                         {
  1947.                             ColdTurkey._Closure$__42-4 CS$<>8__locals5 = new ColdTurkey._Closure$__42-4(CS$<>8__locals5);
  1948.                             CS$<>8__locals5.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader8["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader8["date"])) % 86400.0;
  1949.                             int num26 = series6.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals5.$VB$Local_midnight * 1000.0);
  1950.                             if (num26 >= 0)
  1951.                             {
  1952.                                 series6.Data[num26] = new double[]
  1953.                                 {
  1954.                                     CS$<>8__locals5.$VB$Local_midnight * 1000.0,
  1955.                                     Math.Round(Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader8["fsum"])) / 60.0, 2)
  1956.                                 };
  1957.                             }
  1958.                         }
  1959.                         series6.Label = text10;
  1960.                         list.Add(series6);
  1961.                     }
  1962.                     goto IL_1AD1;
  1963.                 }
  1964.                 finally
  1965.                 {
  1966.                     List<string>.Enumerator enumerator3;
  1967.                     ((IDisposable)enumerator3).Dispose();
  1968.                 }
  1969.                 IL_EB6:
  1970.                 string text11 = "";
  1971.                 string text12 = "";
  1972.                 if (Operators.CompareString(chartUsers, "all", false) != 0)
  1973.                 {
  1974.                     text12 = " AND user = '" + chartUsers.Replace("'", "''") + "'";
  1975.                 }
  1976.                 if (Operators.CompareString(chartOptions, "all", false) != 0)
  1977.                 {
  1978.                     List<string> values3 = new List<string>(this.settings.Blocks[chartOptions].Apps.Where((ColdTurkey._Closure$__.$I42-9 == null) ? (ColdTurkey._Closure$__.$I42-9 = ((string entry) => entry.StartsWith("file:") | entry.StartsWith("win10:"))) : ColdTurkey._Closure$__.$I42-9).Select((ColdTurkey._Closure$__.$I42-10 == null) ? (ColdTurkey._Closure$__.$I42-10 = ((string entry) => entry.Substring(checked(entry.LastIndexOf("/") + 1)))) : ColdTurkey._Closure$__.$I42-10));
  1979.                     text11 = " AND ffile IN ('" + string.Join("','", values3) + "')";
  1980.                 }
  1981.                 List<string> list5 = new List<string>();
  1982.                 SQLiteDataReader sqliteDataReader9 = new SQLiteCommand(string.Concat(new string[]
  1983.                 {
  1984.                     "SELECT REPLACE(file, RTRIM(file, REPLACE(file, '/', '')), '') AS ffile FROM statsApp WHERE (date >= ",
  1985.                     text,
  1986.                     " AND date <= ",
  1987.                     text2,
  1988.                     ")",
  1989.                     text12,
  1990.                     text11,
  1991.                     " GROUP BY ffile ORDER BY SUM(seconds) DESC LIMIT 5"
  1992.                 }), this.dbHelper).ExecuteReader();
  1993.                 while (sqliteDataReader9.Read())
  1994.                 {
  1995.                     list5.Add(sqliteDataReader9["ffile"].ToString());
  1996.                 }
  1997.                 try
  1998.                 {
  1999.                     foreach (string text13 in list5)
  2000.                     {
  2001.                         Series series7 = new Series();
  2002.                         double num27 = num;
  2003.                         double num28 = num2;
  2004.                         for (double num29 = num27; num29 <= num28; num29 += 86400.0)
  2005.                         {
  2006.                             List<double[]> data7 = series7.Data;
  2007.                             double[] array7 = new double[2];
  2008.                             array7[0] = num29 * 1000.0;
  2009.                             data7.Add(array7);
  2010.                         }
  2011.                         SQLiteDataReader sqliteDataReader10 = new SQLiteCommand(string.Concat(new string[]
  2012.                         {
  2013.                             "SELECT date, SUM(seconds) AS fsum FROM statsApp WHERE (date >= ",
  2014.                             text,
  2015.                             " AND date <= ",
  2016.                             text2,
  2017.                             ")",
  2018.                             text12,
  2019.                             " AND REPLACE(file, RTRIM(file, REPLACE(file, '/', '')), '') = '",
  2020.                             text13.Replace("'", "''"),
  2021.                             "' GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  2022.                         }), this.dbHelper).ExecuteReader();
  2023.                         while (sqliteDataReader10.Read())
  2024.                         {
  2025.                             ColdTurkey._Closure$__42-5 CS$<>8__locals6 = new ColdTurkey._Closure$__42-5(CS$<>8__locals6);
  2026.                             CS$<>8__locals6.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader10["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader10["date"])) % 86400.0;
  2027.                             int num30 = series7.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals6.$VB$Local_midnight * 1000.0);
  2028.                             if (num30 >= 0)
  2029.                             {
  2030.                                 series7.Data[num30] = new double[]
  2031.                                 {
  2032.                                     CS$<>8__locals6.$VB$Local_midnight * 1000.0,
  2033.                                     Math.Round(Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader10["fsum"])) / 60.0, 2)
  2034.                                 };
  2035.                             }
  2036.                         }
  2037.                         series7.Label = text13;
  2038.                         list.Add(series7);
  2039.                     }
  2040.                     goto IL_1AD1;
  2041.                 }
  2042.                 finally
  2043.                 {
  2044.                     List<string>.Enumerator enumerator4;
  2045.                     ((IDisposable)enumerator4).Dispose();
  2046.                 }
  2047.                 IL_11CA:
  2048.                 string text14 = "";
  2049.                 string text15 = "";
  2050.                 if (Operators.CompareString(chartUsers, "all", false) != 0)
  2051.                 {
  2052.                     text15 = " AND user = '" + chartUsers.Replace("'", "''") + "'";
  2053.                 }
  2054.                 if (Operators.CompareString(chartOptions, "all", false) != 0)
  2055.                 {
  2056.                     List<string> values4 = new List<string>(this.settings.Blocks[chartOptions].Apps.Where((ColdTurkey._Closure$__.$I42-12 == null) ? (ColdTurkey._Closure$__.$I42-12 = ((string entry) => entry.StartsWith("file:") | entry.StartsWith("win10:"))) : ColdTurkey._Closure$__.$I42-12).Select((ColdTurkey._Closure$__.$I42-13 == null) ? (ColdTurkey._Closure$__.$I42-13 = ((string entry) => entry.Substring(checked(entry.LastIndexOf("/") + 1)))) : ColdTurkey._Closure$__.$I42-13));
  2057.                     text14 = " AND ffile IN ('" + string.Join("','", values4) + "')";
  2058.                 }
  2059.                 List<string> list6 = new List<string>();
  2060.                 SQLiteDataReader sqliteDataReader11 = new SQLiteCommand(string.Concat(new string[]
  2061.                 {
  2062.                     "SELECT REPLACE(file, RTRIM(file, REPLACE(file, '/', '')), '') AS ffile FROM statsApp WHERE (date >= ",
  2063.                     text,
  2064.                     " AND date <= ",
  2065.                     text2,
  2066.                     ")",
  2067.                     text15,
  2068.                     text14,
  2069.                     " GROUP BY ffile ORDER BY SUM(seconds) DESC LIMIT 10"
  2070.                 }), this.dbHelper).ExecuteReader();
  2071.                 while (sqliteDataReader11.Read())
  2072.                 {
  2073.                     list6.Add(sqliteDataReader11["ffile"].ToString());
  2074.                 }
  2075.                 try
  2076.                 {
  2077.                     foreach (string text16 in list6)
  2078.                     {
  2079.                         Series series8 = new Series();
  2080.                         double num31 = num;
  2081.                         double num32 = num2;
  2082.                         for (double num33 = num31; num33 <= num32; num33 += 86400.0)
  2083.                         {
  2084.                             List<double[]> data8 = series8.Data;
  2085.                             double[] array8 = new double[2];
  2086.                             array8[0] = num33 * 1000.0;
  2087.                             data8.Add(array8);
  2088.                         }
  2089.                         SQLiteDataReader sqliteDataReader12 = new SQLiteCommand(string.Concat(new string[]
  2090.                         {
  2091.                             "SELECT date, SUM(seconds) AS fsum FROM statsApp WHERE (date >= ",
  2092.                             text,
  2093.                             " AND date <= ",
  2094.                             text2,
  2095.                             ")",
  2096.                             text15,
  2097.                             " AND REPLACE(file, RTRIM(file, REPLACE(file, '/', '')), '') = '",
  2098.                             text16.Replace("'", "''"),
  2099.                             "' GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  2100.                         }), this.dbHelper).ExecuteReader();
  2101.                         while (sqliteDataReader12.Read())
  2102.                         {
  2103.                             ColdTurkey._Closure$__42-6 CS$<>8__locals7 = new ColdTurkey._Closure$__42-6(CS$<>8__locals7);
  2104.                             CS$<>8__locals7.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader12["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader12["date"])) % 86400.0;
  2105.                             int num34 = series8.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals7.$VB$Local_midnight * 1000.0);
  2106.                             if (num34 >= 0)
  2107.                             {
  2108.                                 series8.Data[num34] = new double[]
  2109.                                 {
  2110.                                     CS$<>8__locals7.$VB$Local_midnight * 1000.0,
  2111.                                     Math.Round(Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader12["fsum"])) / 60.0, 2)
  2112.                                 };
  2113.                             }
  2114.                         }
  2115.                         series8.Label = text16;
  2116.                         list.Add(series8);
  2117.                     }
  2118.                     goto IL_1AD1;
  2119.                 }
  2120.                 finally
  2121.                 {
  2122.                     List<string>.Enumerator enumerator5;
  2123.                     ((IDisposable)enumerator5).Dispose();
  2124.                 }
  2125.                 IL_14DE:
  2126.                 string text17 = "";
  2127.                 if (Operators.CompareString(chartUsers, "all", false) != 0)
  2128.                 {
  2129.                     text17 = " AND user = '" + chartUsers.Replace("'", "''") + "'";
  2130.                 }
  2131.                 if (chartOptions == null | Operators.CompareString(chartOptions, "", false) == 0)
  2132.                 {
  2133.                     Series series9 = new Series();
  2134.                     double num35 = num;
  2135.                     double num36 = num2;
  2136.                     for (double num37 = num35; num37 <= num36; num37 += 86400.0)
  2137.                     {
  2138.                         List<double[]> data9 = series9.Data;
  2139.                         double[] array9 = new double[2];
  2140.                         array9[0] = num37 * 1000.0;
  2141.                         data9.Add(array9);
  2142.                     }
  2143.                     series9.Label = "";
  2144.                     list.Add(series9);
  2145.                     goto IL_1AD1;
  2146.                 }
  2147.                 List<string> list7 = new List<string>();
  2148.                 SQLiteDataReader sqliteDataReader13 = new SQLiteCommand(string.Concat(new string[]
  2149.                 {
  2150.                     "SELECT REPLACE(file, RTRIM(file, REPLACE(file, '/', '')), '') AS ffile FROM statsApp WHERE (date >= ",
  2151.                     text,
  2152.                     " AND date <= ",
  2153.                     text2,
  2154.                     ")",
  2155.                     text17,
  2156.                     " AND ffile LIKE '%",
  2157.                     chartOptions.Replace("'", "''"),
  2158.                     "%' GROUP BY ffile ORDER BY SUM(seconds) DESC LIMIT 10"
  2159.                 }), this.dbHelper).ExecuteReader();
  2160.                 while (sqliteDataReader13.Read())
  2161.                 {
  2162.                     list7.Add(sqliteDataReader13["ffile"].ToString());
  2163.                 }
  2164.                 try
  2165.                 {
  2166.                     foreach (string text18 in list7)
  2167.                     {
  2168.                         Series series10 = new Series();
  2169.                         double num38 = num;
  2170.                         double num39 = num2;
  2171.                         for (double num40 = num38; num40 <= num39; num40 += 86400.0)
  2172.                         {
  2173.                             List<double[]> data10 = series10.Data;
  2174.                             double[] array10 = new double[2];
  2175.                             array10[0] = num40 * 1000.0;
  2176.                             data10.Add(array10);
  2177.                         }
  2178.                         SQLiteDataReader sqliteDataReader14 = new SQLiteCommand(string.Concat(new string[]
  2179.                         {
  2180.                             "SELECT date, SUM(seconds) AS fsum FROM statsApp WHERE (date >= ",
  2181.                             text,
  2182.                             " AND date <= ",
  2183.                             text2,
  2184.                             ")",
  2185.                             text17,
  2186.                             " AND REPLACE(file, RTRIM(file, REPLACE(file, '/', '')), '') = '",
  2187.                             text18.Replace("'", "''"),
  2188.                             "' GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  2189.                         }), this.dbHelper).ExecuteReader();
  2190.                         while (sqliteDataReader14.Read())
  2191.                         {
  2192.                             ColdTurkey._Closure$__42-7 CS$<>8__locals8 = new ColdTurkey._Closure$__42-7(CS$<>8__locals8);
  2193.                             CS$<>8__locals8.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader14["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader14["date"])) % 86400.0;
  2194.                             int num41 = series10.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals8.$VB$Local_midnight * 1000.0);
  2195.                             if (num41 >= 0)
  2196.                             {
  2197.                                 series10.Data[num41] = new double[]
  2198.                                 {
  2199.                                     CS$<>8__locals8.$VB$Local_midnight * 1000.0,
  2200.                                     Math.Round(Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader14["fsum"])) / 60.0, 2)
  2201.                                 };
  2202.                             }
  2203.                         }
  2204.                         series10.Label = text18;
  2205.                         list.Add(series10);
  2206.                     }
  2207.                     goto IL_1AD1;
  2208.                 }
  2209.                 finally
  2210.                 {
  2211.                     List<string>.Enumerator enumerator6;
  2212.                     ((IDisposable)enumerator6).Dispose();
  2213.                 }
  2214.                 IL_17D9:
  2215.                 string text19 = "";
  2216.                 if (Operators.CompareString(chartUsers, "all", false) != 0)
  2217.                 {
  2218.                     text19 = " AND user = '" + chartUsers.Replace("'", "''") + "'";
  2219.                 }
  2220.                 if (chartOptions == null | Operators.CompareString(chartOptions, "", false) == 0)
  2221.                 {
  2222.                     Series series11 = new Series();
  2223.                     double num42 = num;
  2224.                     double num43 = num2;
  2225.                     for (double num44 = num42; num44 <= num43; num44 += 86400.0)
  2226.                     {
  2227.                         List<double[]> data11 = series11.Data;
  2228.                         double[] array11 = new double[2];
  2229.                         array11[0] = num44 * 1000.0;
  2230.                         data11.Add(array11);
  2231.                     }
  2232.                     series11.Label = "";
  2233.                     list.Add(series11);
  2234.                 }
  2235.                 else
  2236.                 {
  2237.                     List<string> list8 = new List<string>();
  2238.                     SQLiteDataReader sqliteDataReader15 = new SQLiteCommand(string.Concat(new string[]
  2239.                     {
  2240.                         "SELECT title FROM statsTitle WHERE (date >= ",
  2241.                         text,
  2242.                         " AND date <= ",
  2243.                         text2,
  2244.                         ")",
  2245.                         text19,
  2246.                         " AND title LIKE '%",
  2247.                         chartOptions.Replace("'", "''"),
  2248.                         "%' GROUP BY title ORDER BY SUM(seconds) DESC LIMIT 10"
  2249.                     }), this.dbHelper).ExecuteReader();
  2250.                     while (sqliteDataReader15.Read())
  2251.                     {
  2252.                         list8.Add(sqliteDataReader15["title"].ToString());
  2253.                     }
  2254.                     try
  2255.                     {
  2256.                         foreach (string text20 in list8)
  2257.                         {
  2258.                             Series series12 = new Series();
  2259.                             double num45 = num;
  2260.                             double num46 = num2;
  2261.                             for (double num47 = num45; num47 <= num46; num47 += 86400.0)
  2262.                             {
  2263.                                 List<double[]> data12 = series12.Data;
  2264.                                 double[] array12 = new double[2];
  2265.                                 array12[0] = num47 * 1000.0;
  2266.                                 data12.Add(array12);
  2267.                             }
  2268.                             SQLiteDataReader sqliteDataReader16 = new SQLiteCommand(string.Concat(new string[]
  2269.                             {
  2270.                                 "SELECT date, SUM(seconds) AS fsum FROM statsTitle WHERE (date >= ",
  2271.                                 text,
  2272.                                 " AND date <= ",
  2273.                                 text2,
  2274.                                 ")",
  2275.                                 text19,
  2276.                                 " AND title = '",
  2277.                                 text20.Replace("'", "''"),
  2278.                                 "' GROUP BY strftime('%Y-%m-%d', date, 'unixepoch')"
  2279.                             }), this.dbHelper).ExecuteReader();
  2280.                             while (sqliteDataReader16.Read())
  2281.                             {
  2282.                                 ColdTurkey._Closure$__42-8 CS$<>8__locals9 = new ColdTurkey._Closure$__42-8(CS$<>8__locals9);
  2283.                                 CS$<>8__locals9.$VB$Local_midnight = Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader16["date"])) - Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader16["date"])) % 86400.0;
  2284.                                 int num48 = series12.Data.FindIndex((double[] point) => point[0] == CS$<>8__locals9.$VB$Local_midnight * 1000.0);
  2285.                                 if (num48 >= 0)
  2286.                                 {
  2287.                                     series12.Data[num48] = new double[]
  2288.                                     {
  2289.                                         CS$<>8__locals9.$VB$Local_midnight * 1000.0,
  2290.                                         Math.Round(Convert.ToDouble(RuntimeHelpers.GetObjectValue(sqliteDataReader16["fsum"])) / 60.0, 2)
  2291.                                     };
  2292.                                 }
  2293.                             }
  2294.                             series12.Label = text20;
  2295.                             list.Add(series12);
  2296.                         }
  2297.                     }
  2298.                     finally
  2299.                     {
  2300.                         List<string>.Enumerator enumerator7;
  2301.                         ((IDisposable)enumerator7).Dispose();
  2302.                     }
  2303.                 }
  2304.                 IL_1AD1:;
  2305.             }
  2306.             catch (Exception ex)
  2307.             {
  2308.             }
  2309.             return JsonConvert.SerializeObject(list);
  2310.         }
  2311.  
  2312.         private void WriteError(Exception e)
  2313.         {
  2314.             string text = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\logs";
  2315.             string text2 = text + "\\error.log";
  2316.             bool append = true;
  2317.             try
  2318.             {
  2319.                 if (Directory.Exists(text))
  2320.                 {
  2321.                     if (File.Exists(text2) && new FileInfo(text2).Length > 1000000L)
  2322.                     {
  2323.                         append = false;
  2324.                     }
  2325.                     using (StreamWriter streamWriter = new StreamWriter(text2, append))
  2326.                     {
  2327.                         streamWriter.WriteLine(string.Concat(new string[]
  2328.                         {
  2329.                             "Cold Turkey Blocker v",
  2330.                             this.currentVersion.ToString("0.00"),
  2331.                             " [",
  2332.                             DateAndTime.Now.ToString(),
  2333.                             "]\r\n",
  2334.                             e.ToString()
  2335.                         }));
  2336.                         goto IL_127;
  2337.                     }
  2338.                 }
  2339.                 Directory.CreateDirectory(text);
  2340.                 using (StreamWriter streamWriter2 = new StreamWriter(text2, append))
  2341.                 {
  2342.                     streamWriter2.WriteLine(string.Concat(new string[]
  2343.                     {
  2344.                         "Cold Turkey Blocker v",
  2345.                         this.currentVersion.ToString("0.00"),
  2346.                         " [",
  2347.                         DateAndTime.Now.ToString(),
  2348.                         "]\r\n",
  2349.                         e.ToString()
  2350.                     }));
  2351.                 }
  2352.                 IL_127:;
  2353.             }
  2354.             catch (Exception ex)
  2355.             {
  2356.                 Console.WriteLine(string.Concat(new string[]
  2357.                 {
  2358.                     "Cold Turkey Blocker v",
  2359.                     this.currentVersion.ToString("0.00"),
  2360.                     " [",
  2361.                     DateAndTime.Now.ToString(),
  2362.                     "]\r\n",
  2363.                     ex.ToString()
  2364.                 }));
  2365.             }
  2366.         }
  2367.  
  2368.         public ColdTurkey()
  2369.         {
  2370.             base.Load += this.ColdTurkey_Load;
  2371.             base.FormClosing += this.ColdTurkey_FormClosing;
  2372.             this.settings = null;
  2373.             this.currentVersion = 4.0;
  2374.             this.firstRun = false;
  2375.             this.previousTrayVisibleState = false;
  2376.             this.lastMinuteChecked = -1;
  2377.             this.webBrowserScale = 100;
  2378.             this.allowances = new Dictionary<string, string>();
  2379.             this.dbApp = new SQLiteConnection("Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-app.db;Version=3;");
  2380.             this.dbBrowser = new SQLiteConnection("Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-browser.db;Version=3;");
  2381.             this.dbHelper = new SQLiteConnection("Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-helper.db;Version=3;");
  2382.             this.dbService = new SQLiteConnection("Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Cold Turkey\\data-service.db;Version=3;");
  2383.             this.InitializeComponent();
  2384.         }
  2385.  
  2386.         private void DisposeOpenObjects()
  2387.         {
  2388.             try
  2389.             {
  2390.                 this.tray.Visible = false;
  2391.                 this.dbApp.Cancel();
  2392.                 this.dbBrowser.Cancel();
  2393.                 this.dbHelper.Cancel();
  2394.                 this.dbService.Cancel();
  2395.                 this.dbApp.Close();
  2396.                 this.dbBrowser.Close();
  2397.                 this.dbHelper.Close();
  2398.                 this.dbService.Close();
  2399.             }
  2400.             catch (Exception ex)
  2401.             {
  2402.             }
  2403.         }
  2404.  
  2405.         private void QuickStartParseFromMenu(object sender, EventArgs e)
  2406.         {
  2407.             try
  2408.             {
  2409.                 ToolStripMenuItem toolStripMenuItem = (ToolStripMenuItem)sender;
  2410.                 string text;
  2411.                 if (Operators.CompareString(toolStripMenuItem.Name, "0", false) == 0)
  2412.                 {
  2413.                     text = toolStripMenuItem.OwnerItem.Text;
  2414.                 }
  2415.                 else
  2416.                 {
  2417.                     text = toolStripMenuItem.OwnerItem.OwnerItem.Text;
  2418.                 }
  2419.                 if (text.EndsWith("..."))
  2420.                 {
  2421.                     text = text.Substring(0, checked(text.Length - 3));
  2422.                 }
  2423.                 this.QuickStart("menu", text, toolStripMenuItem.Name);
  2424.             }
  2425.             catch (Exception e2)
  2426.             {
  2427.                 this.WriteError(e2);
  2428.             }
  2429.         }
  2430.  
  2431.         private void QuickStart(string sender, string blockId, string lockDuration)
  2432.         {
  2433.             try
  2434.             {
  2435.                 if (Operators.CompareString(this.settings.Blocks[blockId].Enabled, "false", false) == 0)
  2436.                 {
  2437.                     int num = int.Parse(lockDuration);
  2438.                     DateTime dateTime = new DateTime(DateAndTime.Now.Year, DateAndTime.Now.Month, DateAndTime.Now.Day, DateAndTime.Now.Hour, DateAndTime.Now.Minute, 0);
  2439.                     DateTime dateTime2 = dateTime.AddMinutes((double)num);
  2440.                     this.settings.Blocks[blockId].Type = "continuous";
  2441.                     this.settings.Blocks[blockId].Enabled = "true";
  2442.                     this.settings.Blocks[blockId].StartTime = string.Concat(new string[]
  2443.                     {
  2444.                         dateTime.Year.ToString(),
  2445.                         ",",
  2446.                         dateTime.Month.ToString(),
  2447.                         ",",
  2448.                         dateTime.Day.ToString(),
  2449.                         ",",
  2450.                         dateTime.Hour.ToString(),
  2451.                         ",",
  2452.                         dateTime.Minute.ToString()
  2453.                     });
  2454.                     string balloonTipText;
  2455.                     if (num == 0)
  2456.                     {
  2457.                         this.settings.Blocks[blockId].Lock = "none";
  2458.                         balloonTipText = "\"" + blockId + "\" is now being blocked.";
  2459.                     }
  2460.                     else
  2461.                     {
  2462.                         this.settings.Blocks[blockId].Lock = string.Concat(new string[]
  2463.                         {
  2464.                             dateTime2.Year.ToString(),
  2465.                             ",",
  2466.                             dateTime2.Month.ToString(),
  2467.                             ",",
  2468.                             dateTime2.Day.ToString(),
  2469.                             ",",
  2470.                             dateTime2.Hour.ToString(),
  2471.                             ",",
  2472.                             dateTime2.Minute.ToString()
  2473.                         });
  2474.                         balloonTipText = string.Concat(new string[]
  2475.                         {
  2476.                             "\"",
  2477.                             blockId,
  2478.                             "\" is now being blocked for ",
  2479.                             lockDuration,
  2480.                             " minutes."
  2481.                         });
  2482.                     }
  2483.                     this.WriteSettingsToDatabase();
  2484.                     if (Operators.CompareString(sender, "menu", false) == 0)
  2485.                     {
  2486.                         this.web.Document.InvokeScript("ForceSettingsUpdate", new object[]
  2487.                         {
  2488.                             this.SendSettings()
  2489.                         });
  2490.                         this.tray.BalloonTipTitle = "Your block started!";
  2491.                         this.tray.BalloonTipText = balloonTipText;
  2492.                         this.tray.BalloonTipIcon = ToolTipIcon.Info;
  2493.                         this.previousTrayVisibleState = this.tray.Visible;
  2494.                         this.tray.Visible = true;
  2495.                         this.tray.ShowBalloonTip(6000);
  2496.                     }
  2497.                 }
  2498.             }
  2499.             catch (Exception e)
  2500.             {
  2501.                 this.WriteError(e);
  2502.             }
  2503.         }
  2504.  
  2505.         private void TrayMenu_Opening(object sender, CancelEventArgs e)
  2506.         {
  2507.             try
  2508.             {
  2509.                 bool flag = false;
  2510.                 List<ToolStripMenuItem> list = new List<ToolStripMenuItem>();
  2511.                 if (Operators.CompareString(this.settings.Settings.Password, "", false) == 0 | Operators.CompareString(this.settings.Settings.PasswordStrict, "false", false) == 0)
  2512.                 {
  2513.                     try
  2514.                     {
  2515.                         foreach (KeyValuePair<string, Block> keyValuePair in this.settings.Blocks)
  2516.                         {
  2517.                             if (Operators.CompareString(keyValuePair.Key, "Frozen Turkey", false) != 0)
  2518.                             {
  2519.                                 ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(keyValuePair.Key + "...")
  2520.                                 {
  2521.                                     Enabled = false
  2522.                                 };
  2523.                                 flag = true;
  2524.                                 if (Operators.CompareString(keyValuePair.Value.Enabled, "false", false) == 0)
  2525.                                 {
  2526.                                     ToolStripMenuItem toolStripMenuItem2 = new ToolStripMenuItem("Start and lock for...");
  2527.                                     ToolStripMenuItem value = new ToolStripMenuItem("Start with no lock", null, new EventHandler(this.QuickStartParseFromMenu), "0");
  2528.                                     List<ToolStripMenuItem> list2 = new List<ToolStripMenuItem>();
  2529.                                     list2.Add(new ToolStripMenuItem("1 day", null, new EventHandler(this.QuickStartParseFromMenu), "1440"));
  2530.                                     list2.Add(new ToolStripMenuItem("12 hours", null, new EventHandler(this.QuickStartParseFromMenu), "720"));
  2531.                                     list2.Add(new ToolStripMenuItem("8 hours", null, new EventHandler(this.QuickStartParseFromMenu), "480"));
  2532.                                     list2.Add(new ToolStripMenuItem("7 hours", null, new EventHandler(this.QuickStartParseFromMenu), "420"));
  2533.                                     list2.Add(new ToolStripMenuItem("6 hours", null, new EventHandler(this.QuickStartParseFromMenu), "360"));
  2534.                                     list2.Add(new ToolStripMenuItem("5 hours", null, new EventHandler(this.QuickStartParseFromMenu), "300"));
  2535.                                     list2.Add(new ToolStripMenuItem("4 hours", null, new EventHandler(this.QuickStartParseFromMenu), "240"));
  2536.                                     list2.Add(new ToolStripMenuItem("3 hours", null, new EventHandler(this.QuickStartParseFromMenu), "180"));
  2537.                                     list2.Add(new ToolStripMenuItem("2 hours", null, new EventHandler(this.QuickStartParseFromMenu), "120"));
  2538.                                     list2.Add(new ToolStripMenuItem("1 hour", null, new EventHandler(this.QuickStartParseFromMenu), "60"));
  2539.                                     list2.Add(new ToolStripMenuItem("50 minutes", null, new EventHandler(this.QuickStartParseFromMenu), "50"));
  2540.                                     list2.Add(new ToolStripMenuItem("45 minutes", null, new EventHandler(this.QuickStartParseFromMenu), "45"));
  2541.                                     list2.Add(new ToolStripMenuItem("30 minutes", null, new EventHandler(this.QuickStartParseFromMenu), "30"));
  2542.                                     list2.Add(new ToolStripMenuItem("25 minutes", null, new EventHandler(this.QuickStartParseFromMenu), "25"));
  2543.                                     list2.Add(new ToolStripMenuItem("20 minutes", null, new EventHandler(this.QuickStartParseFromMenu), "20"));
  2544.                                     list2.Add(new ToolStripMenuItem("15 minutes", null, new EventHandler(this.QuickStartParseFromMenu), "15"));
  2545.                                     list2.Add(new ToolStripMenuItem("10 minutes", null, new EventHandler(this.QuickStartParseFromMenu), "10"));
  2546.                                     list2.Add(new ToolStripMenuItem("5 minutes", null, new EventHandler(this.QuickStartParseFromMenu), "5"));
  2547.                                     toolStripMenuItem2.DropDownItems.AddRange(list2.ToArray());
  2548.                                     toolStripMenuItem.Enabled = true;
  2549.                                     toolStripMenuItem.DropDownItems.Add(value);
  2550.                                     toolStripMenuItem.DropDownItems.Add(toolStripMenuItem2);
  2551.                                 }
  2552.                                 list.Add(toolStripMenuItem);
  2553.                             }
  2554.                         }
  2555.                     }
  2556.                     finally
  2557.                     {
  2558.                         Dictionary<string, Block>.Enumerator enumerator;
  2559.                         ((IDisposable)enumerator).Dispose();
  2560.                     }
  2561.                 }
  2562.                 this.startTimerList.DropDownItems.Clear();
  2563.                 if (flag)
  2564.                 {
  2565.                     this.startTimerList.Enabled = true;
  2566.                     this.startTimerList.DropDownItems.AddRange(list.ToArray());
  2567.                 }
  2568.                 else
  2569.                 {
  2570.                     this.startTimerList.Enabled = false;
  2571.                 }
  2572.             }
  2573.             catch (Exception e2)
  2574.             {
  2575.                 this.WriteError(e2);
  2576.             }
  2577.         }
  2578.  
  2579.         public void UpdateButton()
  2580.         {
  2581.             try
  2582.             {
  2583.                 Process.Start("http://getcoldturkey.com/support/update/win/");
  2584.             }
  2585.             catch (Exception e)
  2586.             {
  2587.                 this.WriteError(e);
  2588.             }
  2589.         }
  2590.  
  2591.         public void UpgradeButton()
  2592.         {
  2593.             try
  2594.             {
  2595.                 Process.Start("https://getcoldturkey.com/support/upgrade/");
  2596.             }
  2597.             catch (Exception e)
  2598.             {
  2599.                 this.WriteError(e);
  2600.             }
  2601.         }
  2602.  
  2603.         public void StoryButton()
  2604.         {
  2605.             try
  2606.             {
  2607.                 Process.Start("https://getcoldturkey.com/support/story/");
  2608.             }
  2609.             catch (Exception e)
  2610.             {
  2611.                 this.WriteError(e);
  2612.             }
  2613.         }
  2614.  
  2615.         public string AddApplication(string type)
  2616.         {
  2617.             string result;
  2618.             if (Operators.CompareString(type, "file", false) == 0)
  2619.             {
  2620.                 List<string> list = new List<string>();
  2621.                 OpenFileDialog openFileDialog = new OpenFileDialog
  2622.                 {
  2623.                     Multiselect = true,
  2624.                     InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
  2625.                     Filter = "Executable files (*.exe, *.bin, *.com)|*.exe;*.bin;*.com",
  2626.                     FilterIndex = 1
  2627.                 };
  2628.                 if (openFileDialog.ShowDialog() == DialogResult.OK)
  2629.                 {
  2630.                     foreach (string input in openFileDialog.FileNames)
  2631.                     {
  2632.                         list.Add("file:" + Regex.Replace(input, "\\\\", "/"));
  2633.                     }
  2634.                 }
  2635.                 result = string.Join("::", list);
  2636.             }
  2637.             else
  2638.             {
  2639.                 FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog
  2640.                 {
  2641.                     RootFolder = Environment.SpecialFolder.MyComputer,
  2642.                     SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
  2643.                     ShowNewFolderButton = false
  2644.                 };
  2645.                 if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
  2646.                 {
  2647.                     result = "folder:" + Regex.Replace(folderBrowserDialog.SelectedPath, "\\\\", "/");
  2648.                 }
  2649.                 else
  2650.                 {
  2651.                     result = "";
  2652.                 }
  2653.             }
  2654.             return result;
  2655.         }
  2656.  
  2657.         public string ImportUrlsFromFile()
  2658.         {
  2659.             string text = "[]";
  2660.             OpenFileDialog openFileDialog = new OpenFileDialog
  2661.             {
  2662.                 Title = "Import URLs from file...",
  2663.                 Multiselect = false,
  2664.                 InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
  2665.                 Filter = "Text file (*.txt)|*.txt",
  2666.                 FilterIndex = 1
  2667.             };
  2668.             checked
  2669.             {
  2670.                 if (openFileDialog.ShowDialog() == DialogResult.OK)
  2671.                 {
  2672.                     try
  2673.                     {
  2674.                         if (File.Exists(openFileDialog.FileName))
  2675.                         {
  2676.                             string[] array = new string[]
  2677.                             {
  2678.                                 ""
  2679.                             };
  2680.                             List<string> list = new List<string>();
  2681.                             string[] array2 = File.ReadAllLines(openFileDialog.FileName);
  2682.                             if (array2.Count<string>() > 5000)
  2683.                             {
  2684.                                 text = "[\"error:list-too-large\"]";
  2685.                             }
  2686.                             else
  2687.                             {
  2688.                                 string[] array3 = array2;
  2689.                                 for (int i = 0; i < array3.Length; i++)
  2690.                                 {
  2691.                                     string text2 = Regex.Replace(array3[i], "[\\t\\r\\n\\\\]", "");
  2692.                                     if (Operators.CompareString(text2, "", false) != 0)
  2693.                                     {
  2694.                                         list.Add(text2);
  2695.                                     }
  2696.                                 }
  2697.                                 text = string.Join("\",\"", list);
  2698.                                 text = "[\"" + text + "\"]";
  2699.                             }
  2700.                         }
  2701.                     }
  2702.                     catch (Exception ex)
  2703.                     {
  2704.                         text = "[\"error:list-invalid\"]";
  2705.                     }
  2706.                 }
  2707.                 return text;
  2708.             }
  2709.         }
  2710.  
  2711.         public string ImportApplicationsFromFile()
  2712.         {
  2713.             string text = "[]";
  2714.             OpenFileDialog openFileDialog = new OpenFileDialog
  2715.             {
  2716.                 Title = "Import applications from file...",
  2717.                 Multiselect = false,
  2718.                 InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
  2719.                 Filter = "Cold Turkey Blocker application list (*.ctbal)|*.ctbal",
  2720.                 FilterIndex = 1
  2721.             };
  2722.             if (openFileDialog.ShowDialog() == DialogResult.OK)
  2723.             {
  2724.                 try
  2725.                 {
  2726.                     if (File.Exists(openFileDialog.FileName))
  2727.                     {
  2728.                         string[] array = File.ReadAllLines(openFileDialog.FileName);
  2729.                         List<string> list = new List<string>();
  2730.                         if (array.Count<string>() > 5000)
  2731.                         {
  2732.                             text = "[\"error:list-too-large\"]";
  2733.                         }
  2734.                         else
  2735.                         {
  2736.                             foreach (string text2 in array)
  2737.                             {
  2738.                                 if (Operators.CompareString(text2, "", false) != 0 & (text2.StartsWith("file:") | text2.StartsWith("folder:") | text2.StartsWith("win10:") | text2.StartsWith("title:")))
  2739.                                 {
  2740.                                     list.Add(text2);
  2741.                                 }
  2742.                             }
  2743.                             text = string.Join("\",\"", list);
  2744.                             text = "[\"" + text + "\"]";
  2745.                         }
  2746.                     }
  2747.                 }
  2748.                 catch (Exception ex)
  2749.                 {
  2750.                     text = "[\"error:list-invalid\"]";
  2751.                 }
  2752.             }
  2753.             return text;
  2754.         }
  2755.  
  2756.         public void ExportList(string listTab, string blockTitle, string data)
  2757.         {
  2758.             string str = new CultureInfo("en-US", false).TextInfo.ToTitleCase(blockTitle.ToLowerInvariant());
  2759.             SaveFileDialog saveFileDialog;
  2760.             if (Operators.CompareString(listTab, "apps", false) == 0)
  2761.             {
  2762.                 saveFileDialog = new SaveFileDialog
  2763.                 {
  2764.                     Title = "Export applications to file...",
  2765.                     InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
  2766.                     Filter = "Cold Turkey Blocker application list (*.ctbal)|*.ctbal",
  2767.                     FilterIndex = 1,
  2768.                     FileName = str + " Applications List",
  2769.                     DefaultExt = "ctbal"
  2770.                 };
  2771.             }
  2772.             else
  2773.             {
  2774.                 saveFileDialog = new SaveFileDialog
  2775.                 {
  2776.                     Title = "Export URLs to file...",
  2777.                     InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
  2778.                     Filter = "Text file (*.txt)|*.txt",
  2779.                     FilterIndex = 1,
  2780.                     FileName = str + " " + listTab,
  2781.                     DefaultExt = "txt"
  2782.                 };
  2783.             }
  2784.             if (saveFileDialog.ShowDialog() == DialogResult.OK)
  2785.             {
  2786.                 try
  2787.                 {
  2788.                     File.WriteAllText(saveFileDialog.FileName, data);
  2789.                 }
  2790.                 catch (Exception ex)
  2791.                 {
  2792.                     Interaction.MsgBox("Error writing to the selected location. Please try saving somewhere else.", MsgBoxStyle.OkOnly, null);
  2793.                 }
  2794.             }
  2795.         }
  2796.  
  2797.         public void ExportBlocks(string data)
  2798.         {
  2799.             SaveFileDialog saveFileDialog = new SaveFileDialog
  2800.             {
  2801.                 Title = "Export all blocks to file...",
  2802.                 InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
  2803.                 Filter = "Cold Turkey Blocker block lists (*.ctbbl)|*.ctbbl",
  2804.                 FilterIndex = 1,
  2805.                 FileName = "Block Lists from " + Environment.MachineName,
  2806.                 DefaultExt = "ctbbl"
  2807.             };
  2808.             if (saveFileDialog.ShowDialog() == DialogResult.OK)
  2809.             {
  2810.                 try
  2811.                 {
  2812.                     File.WriteAllText(saveFileDialog.FileName, data);
  2813.                 }
  2814.                 catch (Exception ex)
  2815.                 {
  2816.                     Interaction.MsgBox("Error writing to the selected location. Please try saving somewhere else.", MsgBoxStyle.OkOnly, null);
  2817.                 }
  2818.             }
  2819.         }
  2820.  
  2821.         public string ImportBlocks()
  2822.         {
  2823.             OpenFileDialog openFileDialog = new OpenFileDialog
  2824.             {
  2825.                 Title = "Import blocks from file...",
  2826.                 Multiselect = false,
  2827.                 InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
  2828.                 Filter = "Cold Turkey Blocker block lists (*.ctbbl)|*.ctbbl",
  2829.                 FilterIndex = 1
  2830.             };
  2831.             if (openFileDialog.ShowDialog() == DialogResult.OK)
  2832.             {
  2833.                 try
  2834.                 {
  2835.                     if (File.Exists(openFileDialog.FileName))
  2836.                     {
  2837.                         string text = File.ReadAllText(openFileDialog.FileName);
  2838.                         if (text.StartsWith("{"))
  2839.                         {
  2840.                             return text;
  2841.                         }
  2842.                     }
  2843.                 }
  2844.                 catch (Exception ex)
  2845.                 {
  2846.                     return "error:blocks-invalid";
  2847.                 }
  2848.             }
  2849.             return "error:blocks-invalid";
  2850.         }
  2851.  
  2852.         public void RefreshBrowser(string browser)
  2853.         {
  2854.             if (Interaction.MsgBox("Cold Turkey Blocker will close the selected browser if it's running. It will then reopen the browser so that you can finish installing the extension.", MsgBoxStyle.OkCancel, "Browser Restart Required") == MsgBoxResult.Ok)
  2855.             {
  2856.                 try
  2857.                 {
  2858.                     Process.Start(new ProcessStartInfo
  2859.                     {
  2860.                         FileName = AppDomain.CurrentDomain.BaseDirectory + "\\CTHostInstaller.exe",
  2861.                         Arguments = browser + " true"
  2862.                     });
  2863.                 }
  2864.                 catch (Exception e)
  2865.                 {
  2866.                     Interaction.MsgBox("A required file: " + AppDomain.CurrentDomain.BaseDirectory + "\\CTHostInstaller.exe is missing. Please reinstall Cold Turkey Blocker.", MsgBoxStyle.OkOnly, null);
  2867.                     this.WriteError(e);
  2868.                 }
  2869.             }
  2870.         }
  2871.  
  2872.         public void InstallBrowserExt(string browser)
  2873.         {
  2874.             try
  2875.             {
  2876.                 Process.Start(new ProcessStartInfo
  2877.                 {
  2878.                     FileName = AppDomain.CurrentDomain.BaseDirectory + "\\CTHostInstaller.exe",
  2879.                     Arguments = browser + " false"
  2880.                 });
  2881.             }
  2882.             catch (Exception e)
  2883.             {
  2884.                 Interaction.MsgBox("A required file: " + AppDomain.CurrentDomain.BaseDirectory + "\\CTHostInstaller.exe is missing. Please reinstall Cold Turkey Blocker.", MsgBoxStyle.OkOnly, null);
  2885.                 this.WriteError(e);
  2886.             }
  2887.         }
  2888.  
  2889.         public void InstallChrome()
  2890.         {
  2891.             try
  2892.             {
  2893.                 Process.Start("https://www.google.com/chrome/");
  2894.             }
  2895.             catch (Exception e)
  2896.             {
  2897.                 this.WriteError(e);
  2898.             }
  2899.         }
  2900.  
  2901.         public void InstallFirefox()
  2902.         {
  2903.             try
  2904.             {
  2905.                 Process.Start("https://www.mozilla.org/firefox/");
  2906.             }
  2907.             catch (Exception e)
  2908.             {
  2909.                 this.WriteError(e);
  2910.             }
  2911.         }
  2912.  
  2913.         public void GetSettings(string settingsInput)
  2914.         {
  2915.             this.settings = JsonConvert.DeserializeObject<Settings>(settingsInput);
  2916.             this.WriteSettingsToDatabase();
  2917.             this.PipeSettingsReloadMessage();
  2918.             this.CalculateAllowances();
  2919.             this.SetWindowTitle();
  2920.         }
  2921.  
  2922.         public void DeleteStats()
  2923.         {
  2924.             Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\ServiceHub.Helper.exe", "-delete-stats");
  2925.         }
  2926.  
  2927.         public void ExportStats(object data)
  2928.         {
  2929.             TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
  2930.             SaveFileDialog saveFileDialog = new SaveFileDialog
  2931.             {
  2932.                 Title = "Export statistics to file...",
  2933.                 InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
  2934.                 Filter = "JSON file (*.json)|*.json",
  2935.                 FilterIndex = 1,
  2936.                 FileName = "Cold Turkey Blocker Statistics",
  2937.                 DefaultExt = "json"
  2938.             };
  2939.             if (saveFileDialog.ShowDialog() == DialogResult.OK)
  2940.             {
  2941.                 try
  2942.                 {
  2943.                     File.WriteAllText(saveFileDialog.FileName, Conversions.ToString(data));
  2944.                 }
  2945.                 catch (Exception ex)
  2946.                 {
  2947.                     Interaction.MsgBox("Error writing to the selected location. Please try saving somewhere else.", MsgBoxStyle.OkOnly, null);
  2948.                 }
  2949.             }
  2950.         }
  2951.  
  2952.         public object CheckProductKey(string productKey)
  2953.         {
  2954.             if (productKey != null && (productKey.Length == 24 & this.IsAlphaNum(productKey.ToUpper())))
  2955.             {
  2956.                 try
  2957.                 {
  2958.                     if (this.GetHTML("https://getcoldturkey.com/activate/activate.php?v=4&key=" + productKey.ToUpper()).Contains("true"))
  2959.                     {
  2960.                         return "pass";
  2961.                     }
  2962.                 }
  2963.                 catch (Exception ex)
  2964.                 {
  2965.                 }
  2966.             }
  2967.             return "fail";
  2968.         }
  2969.  
  2970.         private bool IsAlphaNum(string code)
  2971.         {
  2972.             string text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  2973.             checked
  2974.             {
  2975.                 for (int i = 0; i < code.Length; i++)
  2976.                 {
  2977.                     string value = Conversions.ToString(code[i]);
  2978.                     if (!text.Contains(value))
  2979.                     {
  2980.                         return false;
  2981.                     }
  2982.                 }
  2983.                 return true;
  2984.             }
  2985.         }
  2986.  
  2987.         private string GetHTML(string strPage)
  2988.         {
  2989.             string result = "NULL";
  2990.             try
  2991.             {
  2992.                 WebResponse response = WebRequest.Create(strPage).GetResponse();
  2993.                 result = new StreamReader(response.GetResponseStream()).ReadToEnd();
  2994.             }
  2995.             catch (Exception ex)
  2996.             {
  2997.             }
  2998.             return result;
  2999.         }
  3000.  
  3001.         public void DisableShortcutsAfterShortDelay()
  3002.         {
  3003.             this.web.WebBrowserShortcutsEnabled = false;
  3004.         }
  3005.  
  3006.         private void WebPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
  3007.         {
  3008.             Keys keyData = e.KeyData;
  3009.             if (keyData <= (Keys)131137)
  3010.             {
  3011.                 if (keyData != Keys.Delete)
  3012.                 {
  3013.                     if (keyData != (Keys)131137)
  3014.                     {
  3015.                         return;
  3016.                     }
  3017.                     this.web.WebBrowserShortcutsEnabled = true;
  3018.                     Task.Delay(50).ContinueWith(delegate(Task a0)
  3019.                     {
  3020.                         this._Lambda$__69-0();
  3021.                     });
  3022.                     return;
  3023.                 }
  3024.                 else
  3025.                 {
  3026.                     this.web.WebBrowserShortcutsEnabled = true;
  3027.                     Task.Delay(50).ContinueWith(delegate(Task a0)
  3028.                     {
  3029.                         this._Lambda$__69-6();
  3030.                     });
  3031.                 }
  3032.             }
  3033.             else
  3034.             {
  3035.                 if (keyData == (Keys)131139)
  3036.                 {
  3037.                     this.web.WebBrowserShortcutsEnabled = true;
  3038.                     Task.Delay(50).ContinueWith(delegate(Task a0)
  3039.                     {
  3040.                         this._Lambda$__69-1();
  3041.                     });
  3042.                     return;
  3043.                 }
  3044.                 if (keyData == (Keys)131142)
  3045.                 {
  3046.                     this.web.WebBrowserShortcutsEnabled = true;
  3047.                     Task.Delay(50).ContinueWith(delegate(Task a0)
  3048.                     {
  3049.                         this._Lambda$__69-2();
  3050.                     });
  3051.                     return;
  3052.                 }
  3053.                 switch (keyData)
  3054.                 {
  3055.                 case (Keys)131158:
  3056.                     this.web.WebBrowserShortcutsEnabled = true;
  3057.                     Task.Delay(50).ContinueWith(delegate(Task a0)
  3058.                     {
  3059.                         this._Lambda$__69-4();
  3060.                     });
  3061.                     return;
  3062.                 case (Keys)131159:
  3063.                 case (Keys)131161:
  3064.                     break;
  3065.                 case (Keys)131160:
  3066.                     this.web.WebBrowserShortcutsEnabled = true;
  3067.                     Task.Delay(50).ContinueWith(delegate(Task a0)
  3068.                     {
  3069.                         this._Lambda$__69-3();
  3070.                     });
  3071.                     return;
  3072.                 case (Keys)131162:
  3073.                     this.web.WebBrowserShortcutsEnabled = true;
  3074.                     Task.Delay(50).ContinueWith(delegate(Task a0)
  3075.                     {
  3076.                         this._Lambda$__69-5();
  3077.                     });
  3078.                     return;
  3079.                 default:
  3080.                     return;
  3081.                 }
  3082.             }
  3083.         }
  3084.  
  3085.         private bool CheckConnection()
  3086.         {
  3087.             int num;
  3088.             return ColdTurkey.InternetGetConnectedState(ref num, 0);
  3089.         }
  3090.  
  3091.         public string GetBrowserInstallList()
  3092.         {
  3093.             List<string> list = new List<string>();
  3094.             List<string> list2 = new List<string>();
  3095.             List<string> list3 = new List<string>();
  3096.             List<string> list4 = new List<string>();
  3097.             checked
  3098.             {
  3099.                 string result;
  3100.                 try
  3101.                 {
  3102.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Google\\Chrome\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Google\\Chrome\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Google\\Chrome\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Google\\Chrome\\Application\\chrome.exe"))
  3103.                     {
  3104.                         string text = null;
  3105.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Google\\Chrome\\User Data\\Local State"))
  3106.                         {
  3107.                             text = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  3108.                         }
  3109.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Google\\Chrome\\User Data\\Local State"))
  3110.                         {
  3111.                             text = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  3112.                         }
  3113.                         if (text != null)
  3114.                         {
  3115.                             JObject jobject = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text + "\\Google\\Chrome\\User Data\\Local State"));
  3116.                             string text2 = null;
  3117.                             if (jobject["profile"]["last_used"] != null)
  3118.                             {
  3119.                                 string text3 = jobject["profile"]["last_used"].ToString();
  3120.                                 if (Operators.CompareString(text3, "", false) != 0)
  3121.                                 {
  3122.                                     text2 = text3;
  3123.                                 }
  3124.                             }
  3125.                             if (text2 == null && jobject["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject["profile"]["last_active_profiles"][0] != null)
  3126.                             {
  3127.                                 string text4 = jobject["profile"]["last_active_profiles"][0].ToString();
  3128.                                 if (Operators.CompareString(text4, "", false) != 0)
  3129.                                 {
  3130.                                     text2 = text4;
  3131.                                 }
  3132.                             }
  3133.                             if (text2 == null)
  3134.                             {
  3135.                                 text2 = "Default";
  3136.                             }
  3137.                             if (File.Exists(text + "\\Google\\Chrome\\User Data\\" + text2 + "\\Secure Preferences") & File.Exists(text + "\\Google\\Chrome\\User Data\\" + text2 + "\\Preferences"))
  3138.                             {
  3139.                                 try
  3140.                                 {
  3141.                                     JObject jobject2 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text + "\\Google\\Chrome\\User Data\\" + text2 + "\\Secure Preferences"));
  3142.                                     JObject jobject3 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text + "\\Google\\Chrome\\User Data\\" + text2 + "\\Preferences"));
  3143.                                     bool flag = false;
  3144.                                     try
  3145.                                     {
  3146.                                         if (jobject2["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject2["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1 && !(bool)jobject2["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["withholding_permissions"])
  3147.                                         {
  3148.                                             flag = true;
  3149.                                         }
  3150.                                     }
  3151.                                     catch (Exception ex)
  3152.                                     {
  3153.                                         try
  3154.                                         {
  3155.                                             if (jobject3["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject3["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1)
  3156.                                             {
  3157.                                                 flag = true;
  3158.                                             }
  3159.                                         }
  3160.                                         catch (Exception ex2)
  3161.                                         {
  3162.                                         }
  3163.                                     }
  3164.                                     if (flag)
  3165.                                     {
  3166.                                         if (this.firstRun)
  3167.                                         {
  3168.                                             bool flag2 = false;
  3169.                                             Process[] processesByName = Process.GetProcessesByName("chrome");
  3170.                                             int i = 0;
  3171.                                             while (i < processesByName.Length)
  3172.                                             {
  3173.                                                 Process process = processesByName[i];
  3174.                                                 string text5;
  3175.                                                 try
  3176.                                                 {
  3177.                                                     text5 = process.MainModule.FileName.ToLowerInvariant();
  3178.                                                 }
  3179.                                                 catch (Exception ex3)
  3180.                                                 {
  3181.                                                     goto IL_38E;
  3182.                                                 }
  3183.                                                 goto IL_37B;
  3184.                                                 IL_38E:
  3185.                                                 i++;
  3186.                                                 continue;
  3187.                                                 IL_37B:
  3188.                                                 if (text5.EndsWith("\\chrome\\application\\chrome.exe"))
  3189.                                                 {
  3190.                                                     flag2 = true;
  3191.                                                     break;
  3192.                                                 }
  3193.                                                 goto IL_38E;
  3194.                                             }
  3195.                                             if (flag2)
  3196.                                             {
  3197.                                                 list2.Add("chrome");
  3198.                                             }
  3199.                                             else
  3200.                                             {
  3201.                                                 list3.Add("chrome");
  3202.                                             }
  3203.                                         }
  3204.                                         else
  3205.                                         {
  3206.                                             list3.Add("chrome");
  3207.                                         }
  3208.                                     }
  3209.                                     else
  3210.                                     {
  3211.                                         list.Add("chrome");
  3212.                                     }
  3213.                                 }
  3214.                                 catch (Exception e)
  3215.                                 {
  3216.                                     this.WriteError(e);
  3217.                                 }
  3218.                             }
  3219.                         }
  3220.                     }
  3221.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Google\\Chrome Beta\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Google\\Chrome Beta\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Google\\Chrome Beta\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Google\\Chrome Beta\\Application\\chrome.exe"))
  3222.                     {
  3223.                         string text6 = null;
  3224.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Google\\Chrome Beta\\User Data\\Local State"))
  3225.                         {
  3226.                             text6 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  3227.                         }
  3228.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Google\\Chrome Beta\\User Data\\Local State"))
  3229.                         {
  3230.                             text6 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  3231.                         }
  3232.                         if (text6 != null)
  3233.                         {
  3234.                             JObject jobject4 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text6 + "\\Google\\Chrome Beta\\User Data\\Local State"));
  3235.                             string text7 = null;
  3236.                             if (jobject4["profile"]["last_used"] != null)
  3237.                             {
  3238.                                 string text8 = jobject4["profile"]["last_used"].ToString();
  3239.                                 if (Operators.CompareString(text8, "", false) != 0)
  3240.                                 {
  3241.                                     text7 = text8;
  3242.                                 }
  3243.                             }
  3244.                             if (text7 == null && jobject4["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject4["profile"]["last_active_profiles"][0] != null)
  3245.                             {
  3246.                                 string text9 = jobject4["profile"]["last_active_profiles"][0].ToString();
  3247.                                 if (Operators.CompareString(text9, "", false) != 0)
  3248.                                 {
  3249.                                     text7 = text9;
  3250.                                 }
  3251.                             }
  3252.                             if (text7 == null)
  3253.                             {
  3254.                                 text7 = "Default";
  3255.                             }
  3256.                             if (File.Exists(text6 + "\\Google\\Chrome Beta\\User Data\\" + text7 + "\\Secure Preferences") & File.Exists(text6 + "\\Google\\Chrome Beta\\User Data\\" + text7 + "\\Preferences"))
  3257.                             {
  3258.                                 try
  3259.                                 {
  3260.                                     JObject jobject5 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text6 + "\\Google\\Chrome Beta\\User Data\\" + text7 + "\\Secure Preferences"));
  3261.                                     JObject jobject6 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text6 + "\\Google\\Chrome Beta\\User Data\\" + text7 + "\\Preferences"));
  3262.                                     bool flag3 = false;
  3263.                                     try
  3264.                                     {
  3265.                                         if (jobject5["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject5["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1 && !(bool)jobject5["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["withholding_permissions"])
  3266.                                         {
  3267.                                             flag3 = true;
  3268.                                         }
  3269.                                     }
  3270.                                     catch (Exception ex4)
  3271.                                     {
  3272.                                         try
  3273.                                         {
  3274.                                             if (jobject6["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject6["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1)
  3275.                                             {
  3276.                                                 flag3 = true;
  3277.                                             }
  3278.                                         }
  3279.                                         catch (Exception ex5)
  3280.                                         {
  3281.                                         }
  3282.                                     }
  3283.                                     if (flag3)
  3284.                                     {
  3285.                                         if (this.firstRun)
  3286.                                         {
  3287.                                             bool flag4 = false;
  3288.                                             Process[] processesByName2 = Process.GetProcessesByName("chrome");
  3289.                                             int j = 0;
  3290.                                             while (j < processesByName2.Length)
  3291.                                             {
  3292.                                                 Process process2 = processesByName2[j];
  3293.                                                 string text10;
  3294.                                                 try
  3295.                                                 {
  3296.                                                     text10 = process2.MainModule.FileName.ToLowerInvariant();
  3297.                                                 }
  3298.                                                 catch (Exception ex6)
  3299.                                                 {
  3300.                                                     goto IL_760;
  3301.                                                 }
  3302.                                                 goto IL_74D;
  3303.                                                 IL_760:
  3304.                                                 j++;
  3305.                                                 continue;
  3306.                                                 IL_74D:
  3307.                                                 if (text10.EndsWith("\\chrome beta\\application\\chrome.exe"))
  3308.                                                 {
  3309.                                                     flag4 = true;
  3310.                                                     break;
  3311.                                                 }
  3312.                                                 goto IL_760;
  3313.                                             }
  3314.                                             if (flag4)
  3315.                                             {
  3316.                                                 list2.Add("chromebeta");
  3317.                                             }
  3318.                                             else
  3319.                                             {
  3320.                                                 list3.Add("chromebeta");
  3321.                                             }
  3322.                                         }
  3323.                                         else
  3324.                                         {
  3325.                                             list3.Add("chromebeta");
  3326.                                         }
  3327.                                     }
  3328.                                     else
  3329.                                     {
  3330.                                         list.Add("chromebeta");
  3331.                                     }
  3332.                                 }
  3333.                                 catch (Exception e2)
  3334.                                 {
  3335.                                     this.WriteError(e2);
  3336.                                 }
  3337.                             }
  3338.                         }
  3339.                     }
  3340.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Google\\Chrome Dev\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Google\\Chrome Dev\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Google\\Chrome Dev\\Application\\chrome.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Google\\Chrome Dev\\Application\\chrome.exe"))
  3341.                     {
  3342.                         string text11 = null;
  3343.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Google\\Chrome Dev\\User Data\\Local State"))
  3344.                         {
  3345.                             text11 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  3346.                         }
  3347.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Google\\Chrome Dev\\User Data\\Local State"))
  3348.                         {
  3349.                             text11 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  3350.                         }
  3351.                         if (text11 != null)
  3352.                         {
  3353.                             JObject jobject7 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text11 + "\\Google\\Chrome Dev\\User Data\\Local State"));
  3354.                             string text12 = null;
  3355.                             if (jobject7["profile"]["last_used"] != null)
  3356.                             {
  3357.                                 string text13 = jobject7["profile"]["last_used"].ToString();
  3358.                                 if (Operators.CompareString(text13, "", false) != 0)
  3359.                                 {
  3360.                                     text12 = text13;
  3361.                                 }
  3362.                             }
  3363.                             if (text12 == null && jobject7["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject7["profile"]["last_active_profiles"][0] != null)
  3364.                             {
  3365.                                 string text14 = jobject7["profile"]["last_active_profiles"][0].ToString();
  3366.                                 if (Operators.CompareString(text14, "", false) != 0)
  3367.                                 {
  3368.                                     text12 = text14;
  3369.                                 }
  3370.                             }
  3371.                             if (text12 == null)
  3372.                             {
  3373.                                 text12 = "Default";
  3374.                             }
  3375.                             if (File.Exists(text11 + "\\Google\\Chrome Dev\\User Data\\" + text12 + "\\Secure Preferences"))
  3376.                             {
  3377.                                 try
  3378.                                 {
  3379.                                     JObject jobject8 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text11 + "\\Google\\Chrome Dev\\User Data\\" + text12 + "\\Secure Preferences"));
  3380.                                     JObject jobject9 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text11 + "\\Google\\Chrome Dev\\User Data\\" + text12 + "\\Preferences"));
  3381.                                     bool flag5 = false;
  3382.                                     try
  3383.                                     {
  3384.                                         if (jobject8["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject8["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1 && !(bool)jobject8["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["withholding_permissions"])
  3385.                                         {
  3386.                                             flag5 = true;
  3387.                                         }
  3388.                                     }
  3389.                                     catch (Exception ex7)
  3390.                                     {
  3391.                                         try
  3392.                                         {
  3393.                                             if (jobject9["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject9["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1)
  3394.                                             {
  3395.                                                 flag5 = true;
  3396.                                             }
  3397.                                         }
  3398.                                         catch (Exception ex8)
  3399.                                         {
  3400.                                         }
  3401.                                     }
  3402.                                     if (flag5)
  3403.                                     {
  3404.                                         if (this.firstRun)
  3405.                                         {
  3406.                                             bool flag6 = false;
  3407.                                             Process[] processesByName3 = Process.GetProcessesByName("chrome");
  3408.                                             int k = 0;
  3409.                                             while (k < processesByName3.Length)
  3410.                                             {
  3411.                                                 Process process3 = processesByName3[k];
  3412.                                                 string text15;
  3413.                                                 try
  3414.                                                 {
  3415.                                                     text15 = process3.MainModule.FileName.ToLowerInvariant();
  3416.                                                 }
  3417.                                                 catch (Exception ex9)
  3418.                                                 {
  3419.                                                     goto IL_B19;
  3420.                                                 }
  3421.                                                 goto IL_B06;
  3422.                                                 IL_B19:
  3423.                                                 k++;
  3424.                                                 continue;
  3425.                                                 IL_B06:
  3426.                                                 if (text15.EndsWith("\\chrome dev\\application\\chrome.exe"))
  3427.                                                 {
  3428.                                                     flag6 = true;
  3429.                                                     break;
  3430.                                                 }
  3431.                                                 goto IL_B19;
  3432.                                             }
  3433.                                             if (flag6)
  3434.                                             {
  3435.                                                 list2.Add("chromedev");
  3436.                                             }
  3437.                                             else
  3438.                                             {
  3439.                                                 list3.Add("chromedev");
  3440.                                             }
  3441.                                         }
  3442.                                         else
  3443.                                         {
  3444.                                             list3.Add("chromedev");
  3445.                                         }
  3446.                                     }
  3447.                                     else
  3448.                                     {
  3449.                                         list.Add("chromedev");
  3450.                                     }
  3451.                                 }
  3452.                                 catch (Exception e3)
  3453.                                 {
  3454.                                     this.WriteError(e3);
  3455.                                 }
  3456.                             }
  3457.                         }
  3458.                     }
  3459.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Microsoft\\Edge\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Microsoft\\Edge\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\Edge\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Edge\\Application\\msedge.exe"))
  3460.                     {
  3461.                         string text16 = null;
  3462.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\Edge\\User Data\\Local State"))
  3463.                         {
  3464.                             text16 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  3465.                         }
  3466.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Edge\\User Data\\Local State"))
  3467.                         {
  3468.                             text16 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  3469.                         }
  3470.                         if (text16 != null)
  3471.                         {
  3472.                             JObject jobject10 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text16 + "\\Microsoft\\Edge\\User Data\\Local State"));
  3473.                             string text17 = null;
  3474.                             if (jobject10["profile"]["last_used"] != null)
  3475.                             {
  3476.                                 string text18 = jobject10["profile"]["last_used"].ToString();
  3477.                                 if (Operators.CompareString(text18, "", false) != 0)
  3478.                                 {
  3479.                                     text17 = text18;
  3480.                                 }
  3481.                             }
  3482.                             if (text17 == null && jobject10["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject10["profile"]["last_active_profiles"][0] != null)
  3483.                             {
  3484.                                 string text19 = jobject10["profile"]["last_active_profiles"][0].ToString();
  3485.                                 if (Operators.CompareString(text19, "", false) != 0)
  3486.                                 {
  3487.                                     text17 = text19;
  3488.                                 }
  3489.                             }
  3490.                             if (text17 == null)
  3491.                             {
  3492.                                 text17 = "Default";
  3493.                             }
  3494.                             if (File.Exists(text16 + "\\Microsoft\\Edge\\User Data\\" + text17 + "\\Secure Preferences") & File.Exists(text16 + "\\Microsoft\\Edge\\User Data\\" + text17 + "\\Preferences"))
  3495.                             {
  3496.                                 try
  3497.                                 {
  3498.                                     JObject jobject11 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text16 + "\\Microsoft\\Edge\\User Data\\" + text17 + "\\Secure Preferences"));
  3499.                                     JObject jobject12 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text16 + "\\Microsoft\\Edge\\User Data\\" + text17 + "\\Preferences"));
  3500.                                     bool flag7 = false;
  3501.                                     try
  3502.                                     {
  3503.                                         if (jobject11["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"] != null && (int)jobject11["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["state"] == 1 && !(bool)jobject11["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["withholding_permissions"])
  3504.                                         {
  3505.                                             flag7 = true;
  3506.                                         }
  3507.                                     }
  3508.                                     catch (Exception ex10)
  3509.                                     {
  3510.                                         try
  3511.                                         {
  3512.                                             if (jobject12["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"] != null && (int)jobject12["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["state"] == 1)
  3513.                                             {
  3514.                                                 flag7 = true;
  3515.                                             }
  3516.                                         }
  3517.                                         catch (Exception ex11)
  3518.                                         {
  3519.                                         }
  3520.                                     }
  3521.                                     if (flag7)
  3522.                                     {
  3523.                                         if (this.firstRun)
  3524.                                         {
  3525.                                             bool flag8 = false;
  3526.                                             Process[] processesByName4 = Process.GetProcessesByName("msedge");
  3527.                                             int l = 0;
  3528.                                             while (l < processesByName4.Length)
  3529.                                             {
  3530.                                                 Process process4 = processesByName4[l];
  3531.                                                 string text20;
  3532.                                                 try
  3533.                                                 {
  3534.                                                     text20 = process4.MainModule.FileName.ToLowerInvariant();
  3535.                                                 }
  3536.                                                 catch (Exception ex12)
  3537.                                                 {
  3538.                                                     goto IL_EEB;
  3539.                                                 }
  3540.                                                 goto IL_ED8;
  3541.                                                 IL_EEB:
  3542.                                                 l++;
  3543.                                                 continue;
  3544.                                                 IL_ED8:
  3545.                                                 if (text20.EndsWith("\\edge\\application\\msedge.exe"))
  3546.                                                 {
  3547.                                                     flag8 = true;
  3548.                                                     break;
  3549.                                                 }
  3550.                                                 goto IL_EEB;
  3551.                                             }
  3552.                                             if (flag8)
  3553.                                             {
  3554.                                                 list2.Add("msedge");
  3555.                                             }
  3556.                                             else
  3557.                                             {
  3558.                                                 list3.Add("msedge");
  3559.                                             }
  3560.                                         }
  3561.                                         else
  3562.                                         {
  3563.                                             list3.Add("msedge");
  3564.                                         }
  3565.                                     }
  3566.                                     else
  3567.                                     {
  3568.                                         list.Add("msedge");
  3569.                                     }
  3570.                                 }
  3571.                                 catch (Exception e4)
  3572.                                 {
  3573.                                     this.WriteError(e4);
  3574.                                 }
  3575.                             }
  3576.                         }
  3577.                     }
  3578.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Microsoft\\Edge Beta\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Microsoft\\Edge Beta\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\Edge Beta\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Edge Beta\\Application\\msedge.exe"))
  3579.                     {
  3580.                         string text21 = null;
  3581.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\Edge Beta\\User Data\\Local State"))
  3582.                         {
  3583.                             text21 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  3584.                         }
  3585.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Edge Beta\\User Data\\Local State"))
  3586.                         {
  3587.                             text21 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  3588.                         }
  3589.                         if (text21 != null)
  3590.                         {
  3591.                             JObject jobject13 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text21 + "\\Microsoft\\Edge Beta\\User Data\\Local State"));
  3592.                             string text22 = null;
  3593.                             if (jobject13["profile"]["last_used"] != null)
  3594.                             {
  3595.                                 string text23 = jobject13["profile"]["last_used"].ToString();
  3596.                                 if (Operators.CompareString(text23, "", false) != 0)
  3597.                                 {
  3598.                                     text22 = text23;
  3599.                                 }
  3600.                             }
  3601.                             if (text22 == null && jobject13["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject13["profile"]["last_active_profiles"][0] != null)
  3602.                             {
  3603.                                 string text24 = jobject13["profile"]["last_active_profiles"][0].ToString();
  3604.                                 if (Operators.CompareString(text24, "", false) != 0)
  3605.                                 {
  3606.                                     text22 = text24;
  3607.                                 }
  3608.                             }
  3609.                             if (text22 == null)
  3610.                             {
  3611.                                 text22 = "Default";
  3612.                             }
  3613.                             if (File.Exists(text21 + "\\Microsoft\\Edge Beta\\User Data\\" + text22 + "\\Secure Preferences") & File.Exists(text21 + "\\Microsoft\\Edge Beta\\User Data\\" + text22 + "\\Preferences"))
  3614.                             {
  3615.                                 try
  3616.                                 {
  3617.                                     JObject jobject14 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text21 + "\\Microsoft\\Edge Beta\\User Data\\" + text22 + "\\Secure Preferences"));
  3618.                                     JObject jobject15 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text21 + "\\Microsoft\\Edge Beta\\User Data\\" + text22 + "\\Preferences"));
  3619.                                     bool flag9 = false;
  3620.                                     try
  3621.                                     {
  3622.                                         if (jobject14["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"] != null && (int)jobject14["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["state"] == 1 && !(bool)jobject14["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["withholding_permissions"])
  3623.                                         {
  3624.                                             flag9 = true;
  3625.                                         }
  3626.                                     }
  3627.                                     catch (Exception ex13)
  3628.                                     {
  3629.                                         try
  3630.                                         {
  3631.                                             if (jobject15["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"] != null && (int)jobject15["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["state"] == 1)
  3632.                                             {
  3633.                                                 flag9 = true;
  3634.                                             }
  3635.                                         }
  3636.                                         catch (Exception ex14)
  3637.                                         {
  3638.                                         }
  3639.                                     }
  3640.                                     if (flag9)
  3641.                                     {
  3642.                                         if (this.firstRun)
  3643.                                         {
  3644.                                             bool flag10 = false;
  3645.                                             Process[] processesByName5 = Process.GetProcessesByName("msedge");
  3646.                                             int m = 0;
  3647.                                             while (m < processesByName5.Length)
  3648.                                             {
  3649.                                                 Process process5 = processesByName5[m];
  3650.                                                 string text25;
  3651.                                                 try
  3652.                                                 {
  3653.                                                     text25 = process5.MainModule.FileName.ToLowerInvariant();
  3654.                                                 }
  3655.                                                 catch (Exception ex15)
  3656.                                                 {
  3657.                                                     goto IL_12BD;
  3658.                                                 }
  3659.                                                 goto IL_12AA;
  3660.                                                 IL_12BD:
  3661.                                                 m++;
  3662.                                                 continue;
  3663.                                                 IL_12AA:
  3664.                                                 if (text25.EndsWith("\\edge beta\\application\\msedge.exe"))
  3665.                                                 {
  3666.                                                     flag10 = true;
  3667.                                                     break;
  3668.                                                 }
  3669.                                                 goto IL_12BD;
  3670.                                             }
  3671.                                             if (flag10)
  3672.                                             {
  3673.                                                 list2.Add("msedgebeta");
  3674.                                             }
  3675.                                             else
  3676.                                             {
  3677.                                                 list3.Add("msedgebeta");
  3678.                                             }
  3679.                                         }
  3680.                                         else
  3681.                                         {
  3682.                                             list3.Add("msedgebeta");
  3683.                                         }
  3684.                                     }
  3685.                                     else
  3686.                                     {
  3687.                                         list.Add("msedgebeta");
  3688.                                     }
  3689.                                 }
  3690.                                 catch (Exception e5)
  3691.                                 {
  3692.                                     this.WriteError(e5);
  3693.                                 }
  3694.                             }
  3695.                         }
  3696.                     }
  3697.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Microsoft\\Edge Dev\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Microsoft\\Edge Dev\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\Edge Dev\\Application\\msedge.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Edge Dev\\Application\\msedge.exe"))
  3698.                     {
  3699.                         string text26 = null;
  3700.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\Edge Dev\\User Data\\Local State"))
  3701.                         {
  3702.                             text26 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  3703.                         }
  3704.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Edge Dev\\User Data\\Local State"))
  3705.                         {
  3706.                             text26 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  3707.                         }
  3708.                         if (text26 != null)
  3709.                         {
  3710.                             JObject jobject16 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text26 + "\\Microsoft\\Edge Dev\\User Data\\Local State"));
  3711.                             string text27 = null;
  3712.                             if (jobject16["profile"]["last_used"] != null)
  3713.                             {
  3714.                                 string text28 = jobject16["profile"]["last_used"].ToString();
  3715.                                 if (Operators.CompareString(text28, "", false) != 0)
  3716.                                 {
  3717.                                     text27 = text28;
  3718.                                 }
  3719.                             }
  3720.                             if (text27 == null && jobject16["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject16["profile"]["last_active_profiles"][0] != null)
  3721.                             {
  3722.                                 string text29 = jobject16["profile"]["last_active_profiles"][0].ToString();
  3723.                                 if (Operators.CompareString(text29, "", false) != 0)
  3724.                                 {
  3725.                                     text27 = text29;
  3726.                                 }
  3727.                             }
  3728.                             if (text27 == null)
  3729.                             {
  3730.                                 text27 = "Default";
  3731.                             }
  3732.                             if (File.Exists(text26 + "\\Microsoft\\Edge Dev\\User Data\\" + text27 + "\\Secure Preferences") & File.Exists(text26 + "\\Microsoft\\Edge Dev\\User Data\\" + text27 + "\\Preferences"))
  3733.                             {
  3734.                                 try
  3735.                                 {
  3736.                                     JObject jobject17 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text26 + "\\Microsoft\\Edge Dev\\User Data\\" + text27 + "\\Secure Preferences"));
  3737.                                     JObject jobject18 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text26 + "\\Microsoft\\Edge Dev\\User Data\\" + text27 + "\\Preferences"));
  3738.                                     bool flag11 = false;
  3739.                                     try
  3740.                                     {
  3741.                                         if (jobject17["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"] != null && (int)jobject17["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["state"] == 1 && !(bool)jobject17["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["withholding_permissions"])
  3742.                                         {
  3743.                                             flag11 = true;
  3744.                                         }
  3745.                                     }
  3746.                                     catch (Exception ex16)
  3747.                                     {
  3748.                                         try
  3749.                                         {
  3750.                                             if (jobject18["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"] != null && (int)jobject18["extensions"]["settings"]["jfphahkinplobmabmgjmjgflbhjjddeb"]["state"] == 1)
  3751.                                             {
  3752.                                                 flag11 = true;
  3753.                                             }
  3754.                                         }
  3755.                                         catch (Exception ex17)
  3756.                                         {
  3757.                                         }
  3758.                                     }
  3759.                                     if (flag11)
  3760.                                     {
  3761.                                         if (this.firstRun)
  3762.                                         {
  3763.                                             bool flag12 = false;
  3764.                                             Process[] processesByName6 = Process.GetProcessesByName("msedge");
  3765.                                             int n = 0;
  3766.                                             while (n < processesByName6.Length)
  3767.                                             {
  3768.                                                 Process process6 = processesByName6[n];
  3769.                                                 string text30;
  3770.                                                 try
  3771.                                                 {
  3772.                                                     text30 = process6.MainModule.FileName.ToLowerInvariant();
  3773.                                                 }
  3774.                                                 catch (Exception ex18)
  3775.                                                 {
  3776.                                                     goto IL_168F;
  3777.                                                 }
  3778.                                                 goto IL_167C;
  3779.                                                 IL_168F:
  3780.                                                 n++;
  3781.                                                 continue;
  3782.                                                 IL_167C:
  3783.                                                 if (text30.EndsWith("\\edge dev\\application\\msedge.exe"))
  3784.                                                 {
  3785.                                                     flag12 = true;
  3786.                                                     break;
  3787.                                                 }
  3788.                                                 goto IL_168F;
  3789.                                             }
  3790.                                             if (flag12)
  3791.                                             {
  3792.                                                 list2.Add("msedgedev");
  3793.                                             }
  3794.                                             else
  3795.                                             {
  3796.                                                 list3.Add("msedgedev");
  3797.                                             }
  3798.                                         }
  3799.                                         else
  3800.                                         {
  3801.                                             list3.Add("msedgedev");
  3802.                                         }
  3803.                                     }
  3804.                                     else
  3805.                                     {
  3806.                                         list.Add("msedgedev");
  3807.                                     }
  3808.                                 }
  3809.                                 catch (Exception e6)
  3810.                                 {
  3811.                                     this.WriteError(e6);
  3812.                                 }
  3813.                             }
  3814.                         }
  3815.                     }
  3816.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\BraveSoftware\\Brave-Browser\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\BraveSoftware\\Brave-Browser\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\BraveSoftware\\Brave-Browser\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"))
  3817.                     {
  3818.                         string text31 = null;
  3819.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\BraveSoftware\\Brave-Browser\\User Data\\Local State"))
  3820.                         {
  3821.                             text31 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  3822.                         }
  3823.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BraveSoftware\\Brave-Browser\\User Data\\Local State"))
  3824.                         {
  3825.                             text31 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  3826.                         }
  3827.                         if (text31 != null)
  3828.                         {
  3829.                             JObject jobject19 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text31 + "\\BraveSoftware\\Brave-Browser\\User Data\\Local State"));
  3830.                             string text32 = null;
  3831.                             if (jobject19["profile"]["last_used"] != null)
  3832.                             {
  3833.                                 string text33 = jobject19["profile"]["last_used"].ToString();
  3834.                                 if (Operators.CompareString(text33, "", false) != 0 & Operators.CompareString(text33, "Tor Profile", false) != 0)
  3835.                                 {
  3836.                                     text32 = text33;
  3837.                                 }
  3838.                             }
  3839.                             if (text32 == null && jobject19["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject19["profile"]["last_active_profiles"][0] != null)
  3840.                             {
  3841.                                 string text34 = jobject19["profile"]["last_active_profiles"][0].ToString();
  3842.                                 if (Operators.CompareString(text34, "", false) != 0)
  3843.                                 {
  3844.                                     text32 = text34;
  3845.                                 }
  3846.                             }
  3847.                             if (text32 == null)
  3848.                             {
  3849.                                 text32 = "Default";
  3850.                             }
  3851.                             if (File.Exists(text31 + "\\BraveSoftware\\Brave-Browser\\User Data\\" + text32 + "\\Secure Preferences") & File.Exists(text31 + "\\BraveSoftware\\Brave-Browser\\User Data\\" + text32 + "\\Preferences"))
  3852.                             {
  3853.                                 try
  3854.                                 {
  3855.                                     JObject jobject20 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text31 + "\\BraveSoftware\\Brave-Browser\\User Data\\" + text32 + "\\Secure Preferences"));
  3856.                                     JObject jobject21 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text31 + "\\BraveSoftware\\Brave-Browser\\User Data\\" + text32 + "\\Preferences"));
  3857.                                     bool flag13 = false;
  3858.                                     try
  3859.                                     {
  3860.                                         if (jobject20["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject20["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1 && !(bool)jobject20["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["withholding_permissions"])
  3861.                                         {
  3862.                                             flag13 = true;
  3863.                                         }
  3864.                                     }
  3865.                                     catch (Exception ex19)
  3866.                                     {
  3867.                                         try
  3868.                                         {
  3869.                                             if (jobject21["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject21["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1)
  3870.                                             {
  3871.                                                 flag13 = true;
  3872.                                             }
  3873.                                         }
  3874.                                         catch (Exception ex20)
  3875.                                         {
  3876.                                         }
  3877.                                     }
  3878.                                     if (flag13)
  3879.                                     {
  3880.                                         if (this.firstRun)
  3881.                                         {
  3882.                                             bool flag14 = false;
  3883.                                             Process[] processesByName7 = Process.GetProcessesByName("brave");
  3884.                                             int num = 0;
  3885.                                             while (num < processesByName7.Length)
  3886.                                             {
  3887.                                                 Process process7 = processesByName7[num];
  3888.                                                 string text35;
  3889.                                                 try
  3890.                                                 {
  3891.                                                     text35 = process7.MainModule.FileName.ToLowerInvariant();
  3892.                                                 }
  3893.                                                 catch (Exception ex21)
  3894.                                                 {
  3895.                                                     goto IL_1A75;
  3896.                                                 }
  3897.                                                 goto IL_1A62;
  3898.                                                 IL_1A75:
  3899.                                                 num++;
  3900.                                                 continue;
  3901.                                                 IL_1A62:
  3902.                                                 if (text35.EndsWith("\\brave-browser\\application\\brave.exe"))
  3903.                                                 {
  3904.                                                     flag14 = true;
  3905.                                                     break;
  3906.                                                 }
  3907.                                                 goto IL_1A75;
  3908.                                             }
  3909.                                             if (flag14)
  3910.                                             {
  3911.                                                 list2.Add("brave");
  3912.                                             }
  3913.                                             else
  3914.                                             {
  3915.                                                 list3.Add("brave");
  3916.                                             }
  3917.                                         }
  3918.                                         else
  3919.                                         {
  3920.                                             list3.Add("brave");
  3921.                                         }
  3922.                                     }
  3923.                                     else
  3924.                                     {
  3925.                                         list.Add("brave");
  3926.                                     }
  3927.                                 }
  3928.                                 catch (Exception e7)
  3929.                                 {
  3930.                                     this.WriteError(e7);
  3931.                                 }
  3932.                             }
  3933.                         }
  3934.                     }
  3935.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\BraveSoftware\\Brave-Browser-Beta\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\BraveSoftware\\Brave-Browser-Beta\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\BraveSoftware\\Brave-Browser-Beta\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BraveSoftware\\Brave-Browser-Beta\\Application\\brave.exe"))
  3936.                     {
  3937.                         string text36 = null;
  3938.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\BraveSoftware\\Brave-Browser-Beta\\User Data\\Local State"))
  3939.                         {
  3940.                             text36 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  3941.                         }
  3942.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BraveSoftware\\Brave-Browser-Beta\\User Data\\Local State"))
  3943.                         {
  3944.                             text36 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  3945.                         }
  3946.                         if (text36 != null)
  3947.                         {
  3948.                             JObject jobject22 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text36 + "\\BraveSoftware\\Brave-Browser-Beta\\User Data\\Local State"));
  3949.                             string text37 = null;
  3950.                             if (jobject22["profile"]["last_used"] != null)
  3951.                             {
  3952.                                 string text38 = jobject22["profile"]["last_used"].ToString();
  3953.                                 if (Operators.CompareString(text38, "", false) != 0 & Operators.CompareString(text38, "Tor Profile", false) != 0)
  3954.                                 {
  3955.                                     text37 = text38;
  3956.                                 }
  3957.                             }
  3958.                             if (text37 == null && jobject22["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject22["profile"]["last_active_profiles"][0] != null)
  3959.                             {
  3960.                                 string text39 = jobject22["profile"]["last_active_profiles"][0].ToString();
  3961.                                 if (Operators.CompareString(text39, "", false) != 0)
  3962.                                 {
  3963.                                     text37 = text39;
  3964.                                 }
  3965.                             }
  3966.                             if (text37 == null)
  3967.                             {
  3968.                                 text37 = "Default";
  3969.                             }
  3970.                             if (File.Exists(text36 + "\\BraveSoftware\\Brave-Browser-Beta\\User Data\\" + text37 + "\\Secure Preferences") & File.Exists(text36 + "\\BraveSoftware\\Brave-Browser-Beta\\User Data\\" + text37 + "\\Preferences"))
  3971.                             {
  3972.                                 try
  3973.                                 {
  3974.                                     JObject jobject23 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text36 + "\\BraveSoftware\\Brave-Browser-Beta\\User Data\\" + text37 + "\\Secure Preferences"));
  3975.                                     JObject jobject24 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text36 + "\\BraveSoftware\\Brave-Browser-Beta\\User Data\\" + text37 + "\\Preferences"));
  3976.                                     bool flag15 = false;
  3977.                                     try
  3978.                                     {
  3979.                                         if (jobject23["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject23["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1 && !(bool)jobject23["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["withholding_permissions"])
  3980.                                         {
  3981.                                             flag15 = true;
  3982.                                         }
  3983.                                     }
  3984.                                     catch (Exception ex22)
  3985.                                     {
  3986.                                         try
  3987.                                         {
  3988.                                             if (jobject24["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject24["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1)
  3989.                                             {
  3990.                                                 flag15 = true;
  3991.                                             }
  3992.                                         }
  3993.                                         catch (Exception ex23)
  3994.                                         {
  3995.                                         }
  3996.                                     }
  3997.                                     if (flag15)
  3998.                                     {
  3999.                                         if (this.firstRun)
  4000.                                         {
  4001.                                             bool flag16 = false;
  4002.                                             Process[] processesByName8 = Process.GetProcessesByName("brave");
  4003.                                             int num2 = 0;
  4004.                                             while (num2 < processesByName8.Length)
  4005.                                             {
  4006.                                                 Process process8 = processesByName8[num2];
  4007.                                                 string text40;
  4008.                                                 try
  4009.                                                 {
  4010.                                                     text40 = process8.MainModule.FileName.ToLowerInvariant();
  4011.                                                 }
  4012.                                                 catch (Exception ex24)
  4013.                                                 {
  4014.                                                     goto IL_1E5B;
  4015.                                                 }
  4016.                                                 goto IL_1E48;
  4017.                                                 IL_1E5B:
  4018.                                                 num2++;
  4019.                                                 continue;
  4020.                                                 IL_1E48:
  4021.                                                 if (text40.EndsWith("\\brave-browser-beta\\application\\brave.exe"))
  4022.                                                 {
  4023.                                                     flag16 = true;
  4024.                                                     break;
  4025.                                                 }
  4026.                                                 goto IL_1E5B;
  4027.                                             }
  4028.                                             if (flag16)
  4029.                                             {
  4030.                                                 list2.Add("bravebeta");
  4031.                                             }
  4032.                                             else
  4033.                                             {
  4034.                                                 list3.Add("bravebeta");
  4035.                                             }
  4036.                                         }
  4037.                                         else
  4038.                                         {
  4039.                                             list3.Add("bravebeta");
  4040.                                         }
  4041.                                     }
  4042.                                     else
  4043.                                     {
  4044.                                         list.Add("bravebeta");
  4045.                                     }
  4046.                                 }
  4047.                                 catch (Exception e8)
  4048.                                 {
  4049.                                     this.WriteError(e8);
  4050.                                 }
  4051.                             }
  4052.                         }
  4053.                     }
  4054.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\BraveSoftware\\Brave-Browser-Dev\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\BraveSoftware\\Brave-Browser-Dev\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\BraveSoftware\\Brave-Browser-Dev\\Application\\brave.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BraveSoftware\\Brave-Browser-Dev\\Application\\brave.exe"))
  4055.                     {
  4056.                         string text41 = null;
  4057.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\BraveSoftware\\Brave-Browser-Dev\\User Data\\Local State"))
  4058.                         {
  4059.                             text41 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  4060.                         }
  4061.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BraveSoftware\\Brave-Browser-Dev\\User Data\\Local State"))
  4062.                         {
  4063.                             text41 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  4064.                         }
  4065.                         if (text41 != null)
  4066.                         {
  4067.                             JObject jobject25 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text41 + "\\BraveSoftware\\Brave-Browser-Dev\\User Data\\Local State"));
  4068.                             string text42 = null;
  4069.                             if (jobject25["profile"]["last_used"] != null)
  4070.                             {
  4071.                                 string text43 = jobject25["profile"]["last_used"].ToString();
  4072.                                 if (Operators.CompareString(text43, "", false) != 0 & Operators.CompareString(text43, "Tor Profile", false) != 0)
  4073.                                 {
  4074.                                     text42 = text43;
  4075.                                 }
  4076.                             }
  4077.                             if (text42 == null && jobject25["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject25["profile"]["last_active_profiles"][0] != null)
  4078.                             {
  4079.                                 string text44 = jobject25["profile"]["last_active_profiles"][0].ToString();
  4080.                                 if (Operators.CompareString(text44, "", false) != 0)
  4081.                                 {
  4082.                                     text42 = text44;
  4083.                                 }
  4084.                             }
  4085.                             if (text42 == null)
  4086.                             {
  4087.                                 text42 = "Default";
  4088.                             }
  4089.                             if (File.Exists(text41 + "\\BraveSoftware\\Brave-Browser-Dev\\User Data\\" + text42 + "\\Secure Preferences"))
  4090.                             {
  4091.                                 try
  4092.                                 {
  4093.                                     JObject jobject26 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text41 + "\\BraveSoftware\\Brave-Browser-Dev\\User Data\\" + text42 + "\\Secure Preferences"));
  4094.                                     JObject jobject27 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text41 + "\\BraveSoftware\\Brave-Browser-Dev\\User Data\\" + text42 + "\\Preferences"));
  4095.                                     bool flag17 = false;
  4096.                                     try
  4097.                                     {
  4098.                                         if (jobject26["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject26["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1 && !(bool)jobject26["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["withholding_permissions"])
  4099.                                         {
  4100.                                             flag17 = true;
  4101.                                         }
  4102.                                     }
  4103.                                     catch (Exception ex25)
  4104.                                     {
  4105.                                         try
  4106.                                         {
  4107.                                             if (jobject27["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject27["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1)
  4108.                                             {
  4109.                                                 flag17 = true;
  4110.                                             }
  4111.                                         }
  4112.                                         catch (Exception ex26)
  4113.                                         {
  4114.                                         }
  4115.                                     }
  4116.                                     if (flag17)
  4117.                                     {
  4118.                                         if (this.firstRun)
  4119.                                         {
  4120.                                             bool flag18 = false;
  4121.                                             Process[] processesByName9 = Process.GetProcessesByName("brave");
  4122.                                             int num3 = 0;
  4123.                                             while (num3 < processesByName9.Length)
  4124.                                             {
  4125.                                                 Process process9 = processesByName9[num3];
  4126.                                                 string text45;
  4127.                                                 try
  4128.                                                 {
  4129.                                                     text45 = process9.MainModule.FileName.ToLowerInvariant();
  4130.                                                 }
  4131.                                                 catch (Exception ex27)
  4132.                                                 {
  4133.                                                     goto IL_2228;
  4134.                                                 }
  4135.                                                 goto IL_2215;
  4136.                                                 IL_2228:
  4137.                                                 num3++;
  4138.                                                 continue;
  4139.                                                 IL_2215:
  4140.                                                 if (text45.EndsWith("\\brave-browser-dev\\application\\brave.exe"))
  4141.                                                 {
  4142.                                                     flag18 = true;
  4143.                                                     break;
  4144.                                                 }
  4145.                                                 goto IL_2228;
  4146.                                             }
  4147.                                             if (flag18)
  4148.                                             {
  4149.                                                 list2.Add("bravedev");
  4150.                                             }
  4151.                                             else
  4152.                                             {
  4153.                                                 list3.Add("bravedev");
  4154.                                             }
  4155.                                         }
  4156.                                         else
  4157.                                         {
  4158.                                             list3.Add("bravedev");
  4159.                                         }
  4160.                                     }
  4161.                                     else
  4162.                                     {
  4163.                                         list.Add("bravedev");
  4164.                                     }
  4165.                                 }
  4166.                                 catch (Exception e9)
  4167.                                 {
  4168.                                     this.WriteError(e9);
  4169.                                 }
  4170.                             }
  4171.                         }
  4172.                     }
  4173.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Mozilla Firefox\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Mozilla Firefox\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Mozilla Firefox\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Mozilla Firefox\\firefox.exe"))
  4174.                     {
  4175.                         string text46 = null;
  4176.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Mozilla\\Firefox\\installs.ini"))
  4177.                         {
  4178.                             text46 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Mozilla\\Firefox";
  4179.                         }
  4180.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Mozilla\\Firefox\\installs.ini"))
  4181.                         {
  4182.                             text46 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Mozilla\\Firefox";
  4183.                         }
  4184.                         if (text46 != null)
  4185.                         {
  4186.                             List<string> list5 = new List<string>();
  4187.                             Dictionary<string, DateTime> dictionary = new Dictionary<string, DateTime>();
  4188.                             string text47 = null;
  4189.                             foreach (string text48 in File.ReadAllLines(text46 + "\\installs.ini"))
  4190.                             {
  4191.                                 if (text48.StartsWith("Default="))
  4192.                                 {
  4193.                                     if (text48.Contains(":\\"))
  4194.                                     {
  4195.                                         list5.Add(text48.Substring("Default=".Length));
  4196.                                     }
  4197.                                     else
  4198.                                     {
  4199.                                         list5.Add(text46 + "\\" + text48.Substring("Default=".Length).Replace("/", "\\"));
  4200.                                     }
  4201.                                 }
  4202.                             }
  4203.                             try
  4204.                             {
  4205.                                 foreach (string text49 in list5)
  4206.                                 {
  4207.                                     if (File.Exists(text49 + "\\compatibility.ini") & File.Exists(text49 + "\\prefs.js"))
  4208.                                     {
  4209.                                         foreach (string text50 in File.ReadAllLines(text49 + "\\compatibility.ini"))
  4210.                                         {
  4211.                                             if (text50.StartsWith("LastPlatformDir=") & text50.EndsWith("\\Mozilla Firefox"))
  4212.                                             {
  4213.                                                 dictionary.Add(text49, File.GetLastWriteTime(text49 + "\\prefs.js"));
  4214.                                             }
  4215.                                         }
  4216.                                     }
  4217.                                 }
  4218.                             }
  4219.                             finally
  4220.                             {
  4221.                                 List<string>.Enumerator enumerator;
  4222.                                 ((IDisposable)enumerator).Dispose();
  4223.                             }
  4224.                             DateTime t = new DateTime(1970, 1, 1);
  4225.                             try
  4226.                             {
  4227.                                 foreach (KeyValuePair<string, DateTime> keyValuePair in dictionary)
  4228.                                 {
  4229.                                     if (DateTime.Compare(keyValuePair.Value, t) > 0)
  4230.                                     {
  4231.                                         text47 = keyValuePair.Key;
  4232.                                         t = keyValuePair.Value;
  4233.                                     }
  4234.                                 }
  4235.                             }
  4236.                             finally
  4237.                             {
  4238.                                 Dictionary<string, DateTime>.Enumerator enumerator2;
  4239.                                 ((IDisposable)enumerator2).Dispose();
  4240.                             }
  4241.                             bool flag19 = false;
  4242.                             if (text47 != null & File.Exists(text47 + "\\extensions.json"))
  4243.                             {
  4244.                                 try
  4245.                                 {
  4246.                                     JObject jobject28 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text47 + "\\extensions.json"));
  4247.                                     try
  4248.                                     {
  4249.                                         foreach (JToken jtoken in ((IEnumerable<JToken>)jobject28["addons"]))
  4250.                                         {
  4251.                                             if (Operators.CompareString(jtoken["id"].ToString(), "coldturkey@getcoldturkey.com", false) == 0 && (bool)jtoken["active"])
  4252.                                             {
  4253.                                                 flag19 = true;
  4254.                                             }
  4255.                                         }
  4256.                                     }
  4257.                                     finally
  4258.                                     {
  4259.                                         IEnumerator<JToken> enumerator3;
  4260.                                         if (enumerator3 != null)
  4261.                                         {
  4262.                                             enumerator3.Dispose();
  4263.                                         }
  4264.                                     }
  4265.                                 }
  4266.                                 catch (Exception ex28)
  4267.                                 {
  4268.                                 }
  4269.                             }
  4270.                             if (flag19)
  4271.                             {
  4272.                                 if (this.firstRun)
  4273.                                 {
  4274.                                     bool flag20 = false;
  4275.                                     Process[] processesByName10 = Process.GetProcessesByName("firefox");
  4276.                                     int num6 = 0;
  4277.                                     while (num6 < processesByName10.Length)
  4278.                                     {
  4279.                                         Process process10 = processesByName10[num6];
  4280.                                         string text51;
  4281.                                         try
  4282.                                         {
  4283.                                             text51 = process10.MainModule.FileName.ToLowerInvariant();
  4284.                                         }
  4285.                                         catch (Exception ex29)
  4286.                                         {
  4287.                                             goto IL_2617;
  4288.                                         }
  4289.                                         goto IL_2606;
  4290.                                         IL_2617:
  4291.                                         num6++;
  4292.                                         continue;
  4293.                                         IL_2606:
  4294.                                         if (text51.EndsWith("\\mozilla firefox\\firefox.exe"))
  4295.                                         {
  4296.                                             flag20 = true;
  4297.                                             goto IL_2617;
  4298.                                         }
  4299.                                         goto IL_2617;
  4300.                                     }
  4301.                                     if (flag20)
  4302.                                     {
  4303.                                         list2.Add("firefox");
  4304.                                     }
  4305.                                     else
  4306.                                     {
  4307.                                         list3.Add("firefox");
  4308.                                     }
  4309.                                 }
  4310.                                 else
  4311.                                 {
  4312.                                     list3.Add("firefox");
  4313.                                 }
  4314.                             }
  4315.                             else
  4316.                             {
  4317.                                 list.Add("firefox");
  4318.                             }
  4319.                         }
  4320.                     }
  4321.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Firefox Developer Edition\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Firefox Developer Edition\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Firefox Developer Edition\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Firefox Developer Edition\\firefox.exe"))
  4322.                     {
  4323.                         string text52 = null;
  4324.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Mozilla\\Firefox\\installs.ini"))
  4325.                         {
  4326.                             text52 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Mozilla\\Firefox";
  4327.                         }
  4328.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Mozilla\\Firefox\\installs.ini"))
  4329.                         {
  4330.                             text52 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Mozilla\\Firefox";
  4331.                         }
  4332.                         if (text52 != null)
  4333.                         {
  4334.                             List<string> list6 = new List<string>();
  4335.                             Dictionary<string, DateTime> dictionary2 = new Dictionary<string, DateTime>();
  4336.                             string text53 = null;
  4337.                             foreach (string text54 in File.ReadAllLines(text52 + "\\installs.ini"))
  4338.                             {
  4339.                                 if (text54.StartsWith("Default="))
  4340.                                 {
  4341.                                     if (text54.Contains(":\\"))
  4342.                                     {
  4343.                                         list6.Add(text54.Substring("Default=".Length));
  4344.                                     }
  4345.                                     else
  4346.                                     {
  4347.                                         list6.Add(text52 + "\\" + text54.Substring("Default=".Length).Replace("/", "\\"));
  4348.                                     }
  4349.                                 }
  4350.                             }
  4351.                             try
  4352.                             {
  4353.                                 foreach (string text55 in list6)
  4354.                                 {
  4355.                                     if (File.Exists(text55 + "\\compatibility.ini") & File.Exists(text55 + "\\prefs.js"))
  4356.                                     {
  4357.                                         foreach (string text56 in File.ReadAllLines(text55 + "\\compatibility.ini"))
  4358.                                         {
  4359.                                             if (text56.StartsWith("LastPlatformDir=") & text56.EndsWith("\\Firefox Developer Edition"))
  4360.                                             {
  4361.                                                 dictionary2.Add(text55, File.GetLastWriteTime(text55 + "\\prefs.js"));
  4362.                                             }
  4363.                                         }
  4364.                                     }
  4365.                                 }
  4366.                             }
  4367.                             finally
  4368.                             {
  4369.                                 List<string>.Enumerator enumerator4;
  4370.                                 ((IDisposable)enumerator4).Dispose();
  4371.                             }
  4372.                             DateTime t2 = new DateTime(1970, 1, 1);
  4373.                             try
  4374.                             {
  4375.                                 foreach (KeyValuePair<string, DateTime> keyValuePair2 in dictionary2)
  4376.                                 {
  4377.                                     if (DateTime.Compare(keyValuePair2.Value, t2) > 0)
  4378.                                     {
  4379.                                         text53 = keyValuePair2.Key;
  4380.                                         t2 = keyValuePair2.Value;
  4381.                                     }
  4382.                                 }
  4383.                             }
  4384.                             finally
  4385.                             {
  4386.                                 Dictionary<string, DateTime>.Enumerator enumerator5;
  4387.                                 ((IDisposable)enumerator5).Dispose();
  4388.                             }
  4389.                             bool flag21 = false;
  4390.                             if (text53 != null & File.Exists(text53 + "\\extensions.json"))
  4391.                             {
  4392.                                 try
  4393.                                 {
  4394.                                     JObject jobject29 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text53 + "\\extensions.json"));
  4395.                                     try
  4396.                                     {
  4397.                                         foreach (JToken jtoken2 in ((IEnumerable<JToken>)jobject29["addons"]))
  4398.                                         {
  4399.                                             if (Operators.CompareString(jtoken2["id"].ToString(), "coldturkey@getcoldturkey.com", false) == 0 && (bool)jtoken2["active"])
  4400.                                             {
  4401.                                                 flag21 = true;
  4402.                                             }
  4403.                                         }
  4404.                                     }
  4405.                                     finally
  4406.                                     {
  4407.                                         IEnumerator<JToken> enumerator6;
  4408.                                         if (enumerator6 != null)
  4409.                                         {
  4410.                                             enumerator6.Dispose();
  4411.                                         }
  4412.                                     }
  4413.                                 }
  4414.                                 catch (Exception ex30)
  4415.                                 {
  4416.                                 }
  4417.                             }
  4418.                             if (flag21)
  4419.                             {
  4420.                                 if (this.firstRun)
  4421.                                 {
  4422.                                     bool flag22 = false;
  4423.                                     Process[] processesByName11 = Process.GetProcessesByName("firefox");
  4424.                                     int num9 = 0;
  4425.                                     while (num9 < processesByName11.Length)
  4426.                                     {
  4427.                                         Process process11 = processesByName11[num9];
  4428.                                         string text57;
  4429.                                         try
  4430.                                         {
  4431.                                             text57 = process11.MainModule.FileName.ToLowerInvariant();
  4432.                                         }
  4433.                                         catch (Exception ex31)
  4434.                                         {
  4435.                                             goto IL_29ED;
  4436.                                         }
  4437.                                         goto IL_29DC;
  4438.                                         IL_29ED:
  4439.                                         num9++;
  4440.                                         continue;
  4441.                                         IL_29DC:
  4442.                                         if (text57.EndsWith("\\firefox developer edition\\firefox.exe"))
  4443.                                         {
  4444.                                             flag22 = true;
  4445.                                             goto IL_29ED;
  4446.                                         }
  4447.                                         goto IL_29ED;
  4448.                                     }
  4449.                                     if (flag22)
  4450.                                     {
  4451.                                         list2.Add("firefoxdev");
  4452.                                     }
  4453.                                     else
  4454.                                     {
  4455.                                         list3.Add("firefoxdev");
  4456.                                     }
  4457.                                 }
  4458.                                 else
  4459.                                 {
  4460.                                     list3.Add("firefoxdev");
  4461.                                 }
  4462.                             }
  4463.                             else
  4464.                             {
  4465.                                 list.Add("firefoxdev");
  4466.                             }
  4467.                         }
  4468.                     }
  4469.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Firefox Nightly\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Firefox Nightly\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Firefox Nightly\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Firefox Nightly\\firefox.exe"))
  4470.                     {
  4471.                         string text58 = null;
  4472.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Mozilla\\Firefox\\installs.ini"))
  4473.                         {
  4474.                             text58 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Mozilla\\Firefox";
  4475.                         }
  4476.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Mozilla\\Firefox\\installs.ini"))
  4477.                         {
  4478.                             text58 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Mozilla\\Firefox";
  4479.                         }
  4480.                         if (text58 != null)
  4481.                         {
  4482.                             try
  4483.                             {
  4484.                                 List<string> list7 = new List<string>();
  4485.                                 Dictionary<string, DateTime> dictionary3 = new Dictionary<string, DateTime>();
  4486.                                 string text59 = null;
  4487.                                 foreach (string text60 in File.ReadAllLines(text58 + "\\installs.ini"))
  4488.                                 {
  4489.                                     if (text60.StartsWith("Default="))
  4490.                                     {
  4491.                                         if (text60.Contains(":\\"))
  4492.                                         {
  4493.                                             list7.Add(text60.Substring("Default=".Length));
  4494.                                         }
  4495.                                         else
  4496.                                         {
  4497.                                             list7.Add(text58 + "\\" + text60.Substring("Default=".Length).Replace("/", "\\"));
  4498.                                         }
  4499.                                     }
  4500.                                 }
  4501.                                 try
  4502.                                 {
  4503.                                     foreach (string text61 in list7)
  4504.                                     {
  4505.                                         if (File.Exists(text61 + "\\compatibility.ini") & File.Exists(text61 + "\\prefs.js"))
  4506.                                         {
  4507.                                             foreach (string text62 in File.ReadAllLines(text61 + "\\compatibility.ini"))
  4508.                                             {
  4509.                                                 if (text62.StartsWith("LastPlatformDir=") & text62.EndsWith("\\Firefox Nightly"))
  4510.                                                 {
  4511.                                                     dictionary3.Add(text61, File.GetLastWriteTime(text61 + "\\prefs.js"));
  4512.                                                 }
  4513.                                             }
  4514.                                         }
  4515.                                     }
  4516.                                 }
  4517.                                 finally
  4518.                                 {
  4519.                                     List<string>.Enumerator enumerator7;
  4520.                                     ((IDisposable)enumerator7).Dispose();
  4521.                                 }
  4522.                                 DateTime t3 = new DateTime(1970, 1, 1);
  4523.                                 try
  4524.                                 {
  4525.                                     foreach (KeyValuePair<string, DateTime> keyValuePair3 in dictionary3)
  4526.                                     {
  4527.                                         if (DateTime.Compare(keyValuePair3.Value, t3) > 0)
  4528.                                         {
  4529.                                             text59 = keyValuePair3.Key;
  4530.                                             t3 = keyValuePair3.Value;
  4531.                                         }
  4532.                                     }
  4533.                                 }
  4534.                                 finally
  4535.                                 {
  4536.                                     Dictionary<string, DateTime>.Enumerator enumerator8;
  4537.                                     ((IDisposable)enumerator8).Dispose();
  4538.                                 }
  4539.                                 bool flag23 = false;
  4540.                                 if (text59 != null & File.Exists(text59 + "\\extensions.json"))
  4541.                                 {
  4542.                                     try
  4543.                                     {
  4544.                                         JObject jobject30 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text59 + "\\extensions.json"));
  4545.                                         try
  4546.                                         {
  4547.                                             foreach (JToken jtoken3 in ((IEnumerable<JToken>)jobject30["addons"]))
  4548.                                             {
  4549.                                                 if (Operators.CompareString(jtoken3["id"].ToString(), "coldturkey@getcoldturkey.com", false) == 0 && (bool)jtoken3["active"])
  4550.                                                 {
  4551.                                                     flag23 = true;
  4552.                                                 }
  4553.                                             }
  4554.                                         }
  4555.                                         finally
  4556.                                         {
  4557.                                             IEnumerator<JToken> enumerator9;
  4558.                                             if (enumerator9 != null)
  4559.                                             {
  4560.                                                 enumerator9.Dispose();
  4561.                                             }
  4562.                                         }
  4563.                                     }
  4564.                                     catch (Exception ex32)
  4565.                                     {
  4566.                                     }
  4567.                                 }
  4568.                                 if (flag23)
  4569.                                 {
  4570.                                     if (this.firstRun)
  4571.                                     {
  4572.                                         bool flag24 = false;
  4573.                                         Process[] processesByName12 = Process.GetProcessesByName("firefox");
  4574.                                         int num12 = 0;
  4575.                                         while (num12 < processesByName12.Length)
  4576.                                         {
  4577.                                             Process process12 = processesByName12[num12];
  4578.                                             string text63;
  4579.                                             try
  4580.                                             {
  4581.                                                 text63 = process12.MainModule.FileName.ToLowerInvariant();
  4582.                                             }
  4583.                                             catch (Exception ex33)
  4584.                                             {
  4585.                                                 goto IL_2DC3;
  4586.                                             }
  4587.                                             goto IL_2DB2;
  4588.                                             IL_2DC3:
  4589.                                             num12++;
  4590.                                             continue;
  4591.                                             IL_2DB2:
  4592.                                             if (text63.EndsWith("\\firefox nightly\\firefox.exe"))
  4593.                                             {
  4594.                                                 flag24 = true;
  4595.                                                 goto IL_2DC3;
  4596.                                             }
  4597.                                             goto IL_2DC3;
  4598.                                         }
  4599.                                         if (flag24)
  4600.                                         {
  4601.                                             list2.Add("firefoxnightly");
  4602.                                         }
  4603.                                         else
  4604.                                         {
  4605.                                             list3.Add("firefoxnightly");
  4606.                                         }
  4607.                                     }
  4608.                                     else
  4609.                                     {
  4610.                                         list3.Add("firefoxnightly");
  4611.                                     }
  4612.                                 }
  4613.                                 else
  4614.                                 {
  4615.                                     list.Add("firefoxnightly");
  4616.                                 }
  4617.                             }
  4618.                             catch (Exception ex34)
  4619.                             {
  4620.                                 list.Add("firefoxnightly");
  4621.                             }
  4622.                         }
  4623.                     }
  4624.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Opera\\launcher.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Opera\\launcher.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Programs\\Opera\\launcher.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Programs\\Opera\\launcher.exe"))
  4625.                     {
  4626.                         string text64 = null;
  4627.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Opera Software\\Opera Stable\\Preferences") & File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Opera Software\\Opera Stable\\Secure Preferences"))
  4628.                         {
  4629.                             text64 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  4630.                         }
  4631.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Opera Software\\Opera Stable\\Preferences") & File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Opera Software\\Opera Stable\\Secure Preferences"))
  4632.                         {
  4633.                             text64 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  4634.                         }
  4635.                         if (text64 != null)
  4636.                         {
  4637.                             try
  4638.                             {
  4639.                                 JObject jobject31 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text64 + "\\Opera Software\\Opera Stable\\Preferences"));
  4640.                                 JObject jobject32 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text64 + "\\Opera Software\\Opera Stable\\Secure Preferences"));
  4641.                                 bool flag25 = false;
  4642.                                 try
  4643.                                 {
  4644.                                     if (jobject31["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"] != null && (int)jobject31["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["state"] == 1)
  4645.                                     {
  4646.                                         flag25 = true;
  4647.                                     }
  4648.                                 }
  4649.                                 catch (Exception ex35)
  4650.                                 {
  4651.                                 }
  4652.                                 try
  4653.                                 {
  4654.                                     if (jobject32["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"] != null && (int)jobject32["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["state"] == 1 && !(bool)jobject32["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["withholding_permissions"])
  4655.                                     {
  4656.                                         flag25 = true;
  4657.                                     }
  4658.                                 }
  4659.                                 catch (Exception ex36)
  4660.                                 {
  4661.                                 }
  4662.                                 try
  4663.                                 {
  4664.                                     if (jobject31["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"] != null && (int)jobject31["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["state"] == 1)
  4665.                                     {
  4666.                                         flag25 = true;
  4667.                                     }
  4668.                                 }
  4669.                                 catch (Exception ex37)
  4670.                                 {
  4671.                                 }
  4672.                                 try
  4673.                                 {
  4674.                                     if (jobject32["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"] != null && (int)jobject32["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["state"] == 1 && !(bool)jobject32["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["withholding_permissions"])
  4675.                                     {
  4676.                                         flag25 = true;
  4677.                                     }
  4678.                                 }
  4679.                                 catch (Exception ex38)
  4680.                                 {
  4681.                                 }
  4682.                                 if (flag25)
  4683.                                 {
  4684.                                     if (this.firstRun)
  4685.                                     {
  4686.                                         bool flag26 = false;
  4687.                                         Process[] processesByName13 = Process.GetProcessesByName("opera");
  4688.                                         int num13 = 0;
  4689.                                         while (num13 < processesByName13.Length)
  4690.                                         {
  4691.                                             Process process13 = processesByName13[num13];
  4692.                                             string input;
  4693.                                             try
  4694.                                             {
  4695.                                                 input = process13.MainModule.FileName.ToLowerInvariant();
  4696.                                             }
  4697.                                             catch (Exception ex39)
  4698.                                             {
  4699.                                                 goto IL_31A0;
  4700.                                             }
  4701.                                             goto IL_3188;
  4702.                                             IL_31A0:
  4703.                                             num13++;
  4704.                                             continue;
  4705.                                             IL_3188:
  4706.                                             if (new Regex(".*\\\\opera\\\\.*\\\\opera.exe").IsMatch(input))
  4707.                                             {
  4708.                                                 flag26 = true;
  4709.                                                 break;
  4710.                                             }
  4711.                                             goto IL_31A0;
  4712.                                         }
  4713.                                         if (flag26)
  4714.                                         {
  4715.                                             list2.Add("opera");
  4716.                                         }
  4717.                                         else
  4718.                                         {
  4719.                                             list3.Add("opera");
  4720.                                         }
  4721.                                     }
  4722.                                     else
  4723.                                     {
  4724.                                         list3.Add("opera");
  4725.                                     }
  4726.                                 }
  4727.                                 else
  4728.                                 {
  4729.                                     list.Add("opera");
  4730.                                 }
  4731.                             }
  4732.                             catch (Exception e10)
  4733.                             {
  4734.                                 this.WriteError(e10);
  4735.                             }
  4736.                         }
  4737.                     }
  4738.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Programs\\Opera GX\\launcher.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Programs\\Opera GX\\launcher.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Opera GX\\launcher.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Opera GX\\launcher.exe"))
  4739.                     {
  4740.                         string text65 = null;
  4741.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Opera Software\\Opera GX Stable\\Preferences") & File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Opera Software\\Opera GX Stable\\Secure Preferences"))
  4742.                         {
  4743.                             text65 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  4744.                         }
  4745.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Opera Software\\Opera GX Stable\\Preferences") & File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Opera Software\\Opera GX Stable\\Secure Preferences"))
  4746.                         {
  4747.                             text65 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  4748.                         }
  4749.                         if (text65 != null)
  4750.                         {
  4751.                             try
  4752.                             {
  4753.                                 JObject jobject33 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text65 + "\\Opera Software\\Opera GX Stable\\Preferences"));
  4754.                                 JObject jobject34 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text65 + "\\Opera Software\\Opera GX Stable\\Secure Preferences"));
  4755.                                 bool flag27 = false;
  4756.                                 try
  4757.                                 {
  4758.                                     if (jobject33["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"] != null && (int)jobject33["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["state"] == 1)
  4759.                                     {
  4760.                                         flag27 = true;
  4761.                                     }
  4762.                                 }
  4763.                                 catch (Exception ex40)
  4764.                                 {
  4765.                                 }
  4766.                                 try
  4767.                                 {
  4768.                                     if (jobject34["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"] != null && (int)jobject34["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["state"] == 1 && !(bool)jobject34["extensions"]["opsettings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["withholding_permissions"])
  4769.                                     {
  4770.                                         flag27 = true;
  4771.                                     }
  4772.                                 }
  4773.                                 catch (Exception ex41)
  4774.                                 {
  4775.                                 }
  4776.                                 try
  4777.                                 {
  4778.                                     if (jobject33["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"] != null && (int)jobject33["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["state"] == 1)
  4779.                                     {
  4780.                                         flag27 = true;
  4781.                                     }
  4782.                                 }
  4783.                                 catch (Exception ex42)
  4784.                                 {
  4785.                                 }
  4786.                                 try
  4787.                                 {
  4788.                                     if (jobject34["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"] != null && (int)jobject34["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["state"] == 1 && !(bool)jobject34["extensions"]["settings"]["efnolkfmdbinpkbnfigocgfglnhahldj"]["withholding_permissions"])
  4789.                                     {
  4790.                                         flag27 = true;
  4791.                                     }
  4792.                                 }
  4793.                                 catch (Exception ex43)
  4794.                                 {
  4795.                                 }
  4796.                                 if (flag27)
  4797.                                 {
  4798.                                     if (this.firstRun)
  4799.                                     {
  4800.                                         bool flag28 = false;
  4801.                                         Process[] processesByName14 = Process.GetProcessesByName("opera");
  4802.                                         int num14 = 0;
  4803.                                         while (num14 < processesByName14.Length)
  4804.                                         {
  4805.                                             Process process14 = processesByName14[num14];
  4806.                                             string input2;
  4807.                                             try
  4808.                                             {
  4809.                                                 input2 = process14.MainModule.FileName.ToLowerInvariant();
  4810.                                             }
  4811.                                             catch (Exception ex44)
  4812.                                             {
  4813.                                                 goto IL_361E;
  4814.                                             }
  4815.                                             goto IL_35FE;
  4816.                                             IL_361E:
  4817.                                             num14++;
  4818.                                             continue;
  4819.                                             IL_35FE:
  4820.                                             if (new Regex(".*\\\\opera gx\\\\.*\\\\opera.exe").IsMatch(input2))
  4821.                                             {
  4822.                                                 flag28 = true;
  4823.                                                 break;
  4824.                                             }
  4825.                                             goto IL_361E;
  4826.                                         }
  4827.                                         if (flag28)
  4828.                                         {
  4829.                                             list2.Add("operagx");
  4830.                                         }
  4831.                                         else
  4832.                                         {
  4833.                                             list3.Add("operagx");
  4834.                                         }
  4835.                                     }
  4836.                                     else
  4837.                                     {
  4838.                                         list3.Add("operagx");
  4839.                                     }
  4840.                                 }
  4841.                                 else
  4842.                                 {
  4843.                                     list.Add("operagx");
  4844.                                 }
  4845.                             }
  4846.                             catch (Exception e11)
  4847.                             {
  4848.                                 this.WriteError(e11);
  4849.                             }
  4850.                         }
  4851.                     }
  4852.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Vivaldi\\Application\\vivaldi.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Vivaldi\\Application\\vivaldi.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Vivaldi\\Application\\vivaldi.exe"))
  4853.                     {
  4854.                         string text66 = null;
  4855.                         if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Vivaldi\\User Data\\Local State"))
  4856.                         {
  4857.                             text66 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
  4858.                         }
  4859.                         else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Vivaldi\\User Data\\Local State"))
  4860.                         {
  4861.                             text66 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  4862.                         }
  4863.                         if (text66 != null)
  4864.                         {
  4865.                             JObject jobject35 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text66 + "\\Vivaldi\\User Data\\Local State"));
  4866.                             string text67 = null;
  4867.                             if (jobject35["profile"]["last_used"] != null)
  4868.                             {
  4869.                                 string text68 = jobject35["profile"]["last_used"].ToString();
  4870.                                 if (Operators.CompareString(text68, "", false) != 0)
  4871.                                 {
  4872.                                     text67 = text68;
  4873.                                 }
  4874.                             }
  4875.                             if (text67 == null && jobject35["profile"]["last_active_profiles"].Count<JToken>() > 0 && jobject35["profile"]["last_active_profiles"][0] != null)
  4876.                             {
  4877.                                 string text69 = jobject35["profile"]["last_active_profiles"][0].ToString();
  4878.                                 if (Operators.CompareString(text69, "", false) != 0)
  4879.                                 {
  4880.                                     text67 = text69;
  4881.                                 }
  4882.                             }
  4883.                             if (text67 == null)
  4884.                             {
  4885.                                 text67 = "Default";
  4886.                             }
  4887.                             if (File.Exists(text66 + "\\Vivaldi\\User Data\\" + text67 + "\\Secure Preferences") & File.Exists(text66 + "\\Vivaldi\\User Data\\" + text67 + "\\Preferences"))
  4888.                             {
  4889.                                 try
  4890.                                 {
  4891.                                     JObject jobject36 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text66 + "\\Vivaldi\\User Data\\" + text67 + "\\Secure Preferences"));
  4892.                                     JObject jobject37 = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(text66 + "\\Vivaldi\\User Data\\" + text67 + "\\Preferences"));
  4893.                                     bool flag29 = false;
  4894.                                     try
  4895.                                     {
  4896.                                         if (jobject36["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject36["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1 && !(bool)jobject36["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["withholding_permissions"])
  4897.                                         {
  4898.                                             flag29 = true;
  4899.                                         }
  4900.                                     }
  4901.                                     catch (Exception ex45)
  4902.                                     {
  4903.                                         try
  4904.                                         {
  4905.                                             if (jobject37["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"] != null && (int)jobject37["extensions"]["settings"]["pganeibhckoanndahmnfggfoeofncnii"]["state"] == 1)
  4906.                                             {
  4907.                                                 flag29 = true;
  4908.                                             }
  4909.                                         }
  4910.                                         catch (Exception ex46)
  4911.                                         {
  4912.                                         }
  4913.                                     }
  4914.                                     if (flag29)
  4915.                                     {
  4916.                                         if (this.firstRun)
  4917.                                         {
  4918.                                             bool flag30 = false;
  4919.                                             Process[] processesByName15 = Process.GetProcessesByName("vivaldi");
  4920.                                             int num15 = 0;
  4921.                                             while (num15 < processesByName15.Length)
  4922.                                             {
  4923.                                                 Process process15 = processesByName15[num15];
  4924.                                                 string text70;
  4925.                                                 try
  4926.                                                 {
  4927.                                                     text70 = process15.MainModule.FileName.ToLowerInvariant();
  4928.                                                 }
  4929.                                                 catch (Exception ex47)
  4930.                                                 {
  4931.                                                     goto IL_3ADD;
  4932.                                                 }
  4933.                                                 goto IL_3AC2;
  4934.                                                 IL_3ADD:
  4935.                                                 num15++;
  4936.                                                 continue;
  4937.                                                 IL_3AC2:
  4938.                                                 if (text70.EndsWith("\\vivaldi\\application\\vivaldi.exe"))
  4939.                                                 {
  4940.                                                     flag30 = true;
  4941.                                                     break;
  4942.                                                 }
  4943.                                                 goto IL_3ADD;
  4944.                                             }
  4945.                                             if (flag30)
  4946.                                             {
  4947.                                                 list2.Add("vivaldi");
  4948.                                             }
  4949.                                             else
  4950.                                             {
  4951.                                                 list3.Add("vivaldi");
  4952.                                             }
  4953.                                         }
  4954.                                         else
  4955.                                         {
  4956.                                             list3.Add("vivaldi");
  4957.                                         }
  4958.                                     }
  4959.                                     else
  4960.                                     {
  4961.                                         list.Add("vivaldi");
  4962.                                     }
  4963.                                 }
  4964.                                 catch (Exception e12)
  4965.                                 {
  4966.                                     this.WriteError(e12);
  4967.                                 }
  4968.                             }
  4969.                         }
  4970.                     }
  4971.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\internet explorer\\iexplore.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86) + "\\internet explorer\\iexplore.exe"))
  4972.                     {
  4973.                         list4.Add("ie");
  4974.                     }
  4975.                     if (Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + "\\SystemApps\\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"))
  4976.                     {
  4977.                         list4.Add("edge");
  4978.                     }
  4979.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Google\\Chrome SxS\\Application\\chrome.exe"))
  4980.                     {
  4981.                         list4.Add("canary");
  4982.                     }
  4983.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Yandex\\YandexBrowser\\Application\\browser.exe"))
  4984.                     {
  4985.                         list4.Add("yandex");
  4986.                     }
  4987.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Firefox Nightly\\firefox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Firefox Nightly\\firefox.exe"))
  4988.                     {
  4989.                         list4.Add("nightly");
  4990.                     }
  4991.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Avant Browser\\avant.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Avant Browser\\avant.exe"))
  4992.                     {
  4993.                         list4.Add("avant");
  4994.                     }
  4995.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Lunascape\\Lunascape6\\Luna.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Lunascape\\Lunascape6\\Luna.exe"))
  4996.                     {
  4997.                         list4.Add("luna");
  4998.                     }
  4999.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Pale Moon\\palemoon.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Pale Moon\\palemoon.exe"))
  5000.                     {
  5001.                         list4.Add("palemoon");
  5002.                     }
  5003.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Waterfox\\waterfox.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Waterfox\\waterfox.exe"))
  5004.                     {
  5005.                         list4.Add("waterfox");
  5006.                     }
  5007.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\SeaMonkey\\seamonkey.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\SeaMonkey\\waterfox.exe"))
  5008.                     {
  5009.                         list4.Add("seamonkey");
  5010.                     }
  5011.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\360Browser\\browser\\application\\360browser.exe"))
  5012.                     {
  5013.                         list4.Add("360browser");
  5014.                     }
  5015.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Maxthon\\Bin\\Maxthon.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Maxthon\\Bin\\Maxthon.exe"))
  5016.                     {
  5017.                         list4.Add("maxthon");
  5018.                     }
  5019.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\UCBrowser\\Application\\UCBrowser.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\UCBrowser\\Application\\UCBrowser.exe"))
  5020.                     {
  5021.                         list4.Add("ucbrowser");
  5022.                     }
  5023.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\baidu\\Baidu Browser\\spark.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\baidu\\Baidu Browser\\spark.exe"))
  5024.                     {
  5025.                         list4.Add("spark");
  5026.                     }
  5027.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\AVAST Software\\Browser\\Application\\AvastBrowser.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\AVAST Software\\Browser\\Application\\AvastBrowser.exe"))
  5028.                     {
  5029.                         list4.Add("avast");
  5030.                     }
  5031.                     if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\AVG\\Browser\\Application\\AVGBrowser.exe") | File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\AVG\\Browser\\Application\\AVGBrowser.exe"))
  5032.                     {
  5033.                         list4.Add("avg");
  5034.                     }
  5035.                     string text71 = string.Join(",", list.ToArray());
  5036.                     string text72 = string.Join(",", list2.ToArray());
  5037.                     string text73 = string.Join(",", list3.ToArray());
  5038.                     string text74 = string.Join(",", list4.ToArray());
  5039.                     this.firstRun = false;
  5040.                     result = string.Concat(new string[]
  5041.                     {
  5042.                         text71,
  5043.                         "@",
  5044.                         text72,
  5045.                         "@",
  5046.                         text73,
  5047.                         "@",
  5048.                         text74
  5049.                     });
  5050.                 }
  5051.                 catch (Exception ex48)
  5052.                 {
  5053.                     result = "@@@";
  5054.                 }
  5055.                 return result;
  5056.             }
  5057.         }
  5058.  
  5059.         private void CalculateAllowancesTimer_Tick(object sender, EventArgs e)
  5060.         {
  5061.             int minute = DateAndTime.Now.Minute;
  5062.             if (minute != this.lastMinuteChecked & DateAndTime.Now.Second >= 5)
  5063.             {
  5064.                 this.lastMinuteChecked = minute;
  5065.                 this.CalculateAllowances();
  5066.             }
  5067.         }
  5068.  
  5069.         private void Tray_BalloonTipClosed(object sender, EventArgs e)
  5070.         {
  5071.             this.tray.Visible = this.previousTrayVisibleState;
  5072.         }
  5073.  
  5074.         private void web_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  5075.         {
  5076.             int num = 63;
  5077.             int num2 = 2;
  5078.             IWebBrowser2 webBrowser = (SHDocVw.WebBrowser)this.web.ActiveXInstance;
  5079.             OLECMDID cmdID = (OLECMDID)num;
  5080.             OLECMDEXECOPT cmdexecopt = (OLECMDEXECOPT)num2;
  5081.             ref int ptr = ref this.webBrowserScale;
  5082.             object value = this.webBrowserScale;
  5083.             ref int ptr2 = ref this.webBrowserScale;
  5084.             object value2 = this.webBrowserScale;
  5085.             webBrowser.ExecWB(cmdID, cmdexecopt, ref value, ref value2);
  5086.             ptr2 = Conversions.ToInteger(value2);
  5087.             ptr = Conversions.ToInteger(value);
  5088.         }
  5089.  
  5090.         [DebuggerNonUserCode]
  5091.         protected override void Dispose(bool disposing)
  5092.         {
  5093.             try
  5094.             {
  5095.                 if (disposing && this.components != null)
  5096.                 {
  5097.                     this.components.Dispose();
  5098.                 }
  5099.             }
  5100.             finally
  5101.             {
  5102.                 base.Dispose(disposing);
  5103.             }
  5104.         }
  5105.  
  5106.         [DebuggerStepThrough]
  5107.         private void InitializeComponent()
  5108.         {
  5109.             this.components = new Container();
  5110.             ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(ColdTurkey));
  5111.             this.tray = new NotifyIcon(this.components);
  5112.             this.trayMenu = new ContextMenuStrip(this.components);
  5113.             this.trayOpen = new ToolStripMenuItem();
  5114.             this.startTimerList = new ToolStripMenuItem();
  5115.             this.ToolStripSeparator1 = new ToolStripSeparator();
  5116.             this.trayAbout = new ToolStripMenuItem();
  5117.             this.trayExit = new ToolStripMenuItem();
  5118.             this.web = new System.Windows.Forms.WebBrowser();
  5119.             this.calculateAllowancesTimer = new Timer(this.components);
  5120.             this.trayMenu.SuspendLayout();
  5121.             base.SuspendLayout();
  5122.             this.tray.ContextMenuStrip = this.trayMenu;
  5123.             this.tray.Icon = (Icon)componentResourceManager.GetObject("tray.Icon");
  5124.             this.tray.Text = "Cold Turkey Blocker";
  5125.             this.trayMenu.ImageScalingSize = new Size(20, 20);
  5126.             this.trayMenu.Items.AddRange(new ToolStripItem[]
  5127.             {
  5128.                 this.trayOpen,
  5129.                 this.startTimerList,
  5130.                 this.ToolStripSeparator1,
  5131.                 this.trayAbout,
  5132.                 this.trayExit
  5133.             });
  5134.             this.trayMenu.Name = "ContextMenuStrip1";
  5135.             this.trayMenu.Size = new Size(227, 98);
  5136.             this.trayOpen.Font = new Font("Segoe UI", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
  5137.             this.trayOpen.Name = "trayOpen";
  5138.             this.trayOpen.Size = new Size(226, 22);
  5139.             this.trayOpen.Text = "Open Cold Turkey Blocker...";
  5140.             this.startTimerList.Enabled = false;
  5141.             this.startTimerList.Name = "startTimerList";
  5142.             this.startTimerList.Size = new Size(226, 22);
  5143.             this.startTimerList.Text = "Start block";
  5144.             this.ToolStripSeparator1.Name = "ToolStripSeparator1";
  5145.             this.ToolStripSeparator1.Size = new Size(223, 6);
  5146.             this.trayAbout.Name = "trayAbout";
  5147.             this.trayAbout.Size = new Size(226, 22);
  5148.             this.trayAbout.Text = "About";
  5149.             this.trayExit.Name = "trayExit";
  5150.             this.trayExit.Size = new Size(226, 22);
  5151.             this.trayExit.Text = "Exit";
  5152.             this.web.AllowWebBrowserDrop = false;
  5153.             this.web.Dock = DockStyle.Fill;
  5154.             this.web.Location = new Point(0, 0);
  5155.             this.web.MinimumSize = new Size(960, 620);
  5156.             this.web.Name = "web";
  5157.             this.web.Size = new Size(960, 620);
  5158.             this.web.TabIndex = 1;
  5159.             this.web.WebBrowserShortcutsEnabled = false;
  5160.             this.calculateAllowancesTimer.Interval = 5000;
  5161.             base.AutoScaleDimensions = new SizeF(96f, 96f);
  5162.             base.AutoScaleMode = AutoScaleMode.Dpi;
  5163.             base.ClientSize = new Size(960, 620);
  5164.             base.Controls.Add(this.web);
  5165.             base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
  5166.             base.Margin = new Padding(2);
  5167.             this.MinimumSize = new Size(976, 659);
  5168.             base.Name = "ColdTurkey";
  5169.             base.StartPosition = FormStartPosition.CenterScreen;
  5170.             this.Text = "Cold Turkey Blocker";
  5171.             this.trayMenu.ResumeLayout(false);
  5172.             base.ResumeLayout(false);
  5173.         }
  5174.  
  5175.         internal virtual NotifyIcon tray
  5176.         {
  5177.             [CompilerGenerated]
  5178.             get
  5179.             {
  5180.                 return this._tray;
  5181.             }
  5182.             [CompilerGenerated]
  5183.             [MethodImpl(MethodImplOptions.Synchronized)]
  5184.             set
  5185.             {
  5186.                 MouseEventHandler value2 = new MouseEventHandler(this.SysTray_MouseClick);
  5187.                 EventHandler value3 = new EventHandler(this.Tray_BalloonTipClosed);
  5188.                 NotifyIcon tray = this._tray;
  5189.                 if (tray != null)
  5190.                 {
  5191.                     tray.MouseClick -= value2;
  5192.                     tray.BalloonTipClosed -= value3;
  5193.                 }
  5194.                 this._tray = value;
  5195.                 tray = this._tray;
  5196.                 if (tray != null)
  5197.                 {
  5198.                     tray.MouseClick += value2;
  5199.                     tray.BalloonTipClosed += value3;
  5200.                 }
  5201.             }
  5202.         }
  5203.  
  5204.         internal virtual ContextMenuStrip trayMenu
  5205.         {
  5206.             [CompilerGenerated]
  5207.             get
  5208.             {
  5209.                 return this._trayMenu;
  5210.             }
  5211.             [CompilerGenerated]
  5212.             [MethodImpl(MethodImplOptions.Synchronized)]
  5213.             set
  5214.             {
  5215.                 CancelEventHandler value2 = new CancelEventHandler(this.TrayMenu_Opening);
  5216.                 ContextMenuStrip trayMenu = this._trayMenu;
  5217.                 if (trayMenu != null)
  5218.                 {
  5219.                     trayMenu.Opening -= value2;
  5220.                 }
  5221.                 this._trayMenu = value;
  5222.                 trayMenu = this._trayMenu;
  5223.                 if (trayMenu != null)
  5224.                 {
  5225.                     trayMenu.Opening += value2;
  5226.                 }
  5227.             }
  5228.         }
  5229.  
  5230.         internal virtual ToolStripSeparator ToolStripSeparator1 { get; [MethodImpl(MethodImplOptions.Synchronized)] set; }
  5231.  
  5232.         internal virtual ToolStripMenuItem trayOpen
  5233.         {
  5234.             [CompilerGenerated]
  5235.             get
  5236.             {
  5237.                 return this._trayOpen;
  5238.             }
  5239.             [CompilerGenerated]
  5240.             [MethodImpl(MethodImplOptions.Synchronized)]
  5241.             set
  5242.             {
  5243.                 EventHandler value2 = new EventHandler(this.TrayOpen_Click);
  5244.                 ToolStripMenuItem trayOpen = this._trayOpen;
  5245.                 if (trayOpen != null)
  5246.                 {
  5247.                     trayOpen.Click -= value2;
  5248.                 }
  5249.                 this._trayOpen = value;
  5250.                 trayOpen = this._trayOpen;
  5251.                 if (trayOpen != null)
  5252.                 {
  5253.                     trayOpen.Click += value2;
  5254.                 }
  5255.             }
  5256.         }
  5257.  
  5258.         internal virtual ToolStripMenuItem trayAbout
  5259.         {
  5260.             [CompilerGenerated]
  5261.             get
  5262.             {
  5263.                 return this._trayAbout;
  5264.             }
  5265.             [CompilerGenerated]
  5266.             [MethodImpl(MethodImplOptions.Synchronized)]
  5267.             set
  5268.             {
  5269.                 EventHandler value2 = new EventHandler(this.TrayAbout_Click);
  5270.                 ToolStripMenuItem trayAbout = this._trayAbout;
  5271.                 if (trayAbout != null)
  5272.                 {
  5273.                     trayAbout.Click -= value2;
  5274.                 }
  5275.                 this._trayAbout = value;
  5276.                 trayAbout = this._trayAbout;
  5277.                 if (trayAbout != null)
  5278.                 {
  5279.                     trayAbout.Click += value2;
  5280.                 }
  5281.             }
  5282.         }
  5283.  
  5284.         internal virtual ToolStripMenuItem startTimerList { get; [MethodImpl(MethodImplOptions.Synchronized)] set; }
  5285.  
  5286.         public virtual System.Windows.Forms.WebBrowser web
  5287.         {
  5288.             [CompilerGenerated]
  5289.             get
  5290.             {
  5291.                 return this._web;
  5292.             }
  5293.             [CompilerGenerated]
  5294.             [MethodImpl(MethodImplOptions.Synchronized)]
  5295.             set
  5296.             {
  5297.                 PreviewKeyDownEventHandler value2 = new PreviewKeyDownEventHandler(this.WebPreviewKeyDown);
  5298.                 WebBrowserDocumentCompletedEventHandler value3 = new WebBrowserDocumentCompletedEventHandler(this.web_DocumentCompleted);
  5299.                 System.Windows.Forms.WebBrowser web = this._web;
  5300.                 if (web != null)
  5301.                 {
  5302.                     web.PreviewKeyDown -= value2;
  5303.                     web.DocumentCompleted -= value3;
  5304.                 }
  5305.                 this._web = value;
  5306.                 web = this._web;
  5307.                 if (web != null)
  5308.                 {
  5309.                     web.PreviewKeyDown += value2;
  5310.                     web.DocumentCompleted += value3;
  5311.                 }
  5312.             }
  5313.         }
  5314.  
  5315.         internal virtual ToolStripMenuItem trayExit
  5316.         {
  5317.             [CompilerGenerated]
  5318.             get
  5319.             {
  5320.                 return this._trayExit;
  5321.             }
  5322.             [CompilerGenerated]
  5323.             [MethodImpl(MethodImplOptions.Synchronized)]
  5324.             set
  5325.             {
  5326.                 EventHandler value2 = new EventHandler(this.TrayExit_Click);
  5327.                 ToolStripMenuItem trayExit = this._trayExit;
  5328.                 if (trayExit != null)
  5329.                 {
  5330.                     trayExit.Click -= value2;
  5331.                 }
  5332.                 this._trayExit = value;
  5333.                 trayExit = this._trayExit;
  5334.                 if (trayExit != null)
  5335.                 {
  5336.                     trayExit.Click += value2;
  5337.                 }
  5338.             }
  5339.         }
  5340.  
  5341.         internal virtual Timer calculateAllowancesTimer
  5342.         {
  5343.             [CompilerGenerated]
  5344.             get
  5345.             {
  5346.                 return this._calculateAllowancesTimer;
  5347.             }
  5348.             [CompilerGenerated]
  5349.             [MethodImpl(MethodImplOptions.Synchronized)]
  5350.             set
  5351.             {
  5352.                 EventHandler value2 = new EventHandler(this.CalculateAllowancesTimer_Tick);
  5353.                 Timer calculateAllowancesTimer = this._calculateAllowancesTimer;
  5354.                 if (calculateAllowancesTimer != null)
  5355.                 {
  5356.                     calculateAllowancesTimer.Tick -= value2;
  5357.                 }
  5358.                 this._calculateAllowancesTimer = value;
  5359.                 calculateAllowancesTimer = this._calculateAllowancesTimer;
  5360.                 if (calculateAllowancesTimer != null)
  5361.                 {
  5362.                     calculateAllowancesTimer.Tick += value2;
  5363.                 }
  5364.             }
  5365.         }
  5366.  
  5367.         public Settings settings;
  5368.  
  5369.         private double currentVersion;
  5370.  
  5371.         private bool firstRun;
  5372.  
  5373.         private bool previousTrayVisibleState;
  5374.  
  5375.         private int lastMinuteChecked;
  5376.  
  5377.         private int webBrowserScale;
  5378.  
  5379.         private Dictionary<string, string> allowances;
  5380.  
  5381.         private SQLiteConnection dbApp;
  5382.  
  5383.         private SQLiteConnection dbBrowser;
  5384.  
  5385.         private SQLiteConnection dbHelper;
  5386.  
  5387.         private SQLiteConnection dbService;
  5388.  
  5389.         private const int ATTACH_PARENT_PROCESS = -1;
  5390.  
  5391.         private IContainer components;
  5392.  
  5393.         public enum DeviceCap
  5394.         {
  5395.             VERTRES = 10,
  5396.             DESKTOPVERTRES = 117,
  5397.             LOGPIXELSY = 90
  5398.         }
  5399.     }
  5400. }
Add Comment
Please, Sign In to add comment