Esempio n. 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            string historyPath = Path.Combine(appdata, "FilteredEdgeBrowser", "history.log.txt");

            if (!File.Exists(historyPath))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(historyPath));
            }

            string bookmarkPath = Path.Combine(appdata, "FilteredEdgeBrowser", "bookmark.log.txt");

            if (!File.Exists(bookmarkPath))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(bookmarkPath));
            }

            historyLog  = new LogFileHandler(historyPath);
            bookmarkLog = new LogFileHandler(bookmarkPath);

            httpPolicy.reloadPolicy(FilteredEdgeBrowser.Properties.Settings.Default.WebPolicyPath);
            timePolicy.reloadPolicy(FilteredEdgeBrowser.Properties.Settings.Default.TimePolicyPath);
        }
Esempio n. 2
0
        private void BrowserForm_Load(object sender, EventArgs e)
        {
            if (System.Diagnostics.Debugger.IsAttached)
            {
                isDebug = true;
            }

            // Init download window:
            DownloadManager.Instance.Show();
            DownloadManager.Instance.Hide();

            string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            string historyPath = Path.Combine(appdata, "FilteredChromeBrowser", "history.log.txt");

            if (!File.Exists(historyPath))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(historyPath));
                File.AppendAllText(historyPath, "");
            }

            string bookmarkPath = Path.Combine(appdata, "FilteredChromeBrowser", "bookmark.log.txt");

            if (!File.Exists(bookmarkPath))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(bookmarkPath));
                File.AppendAllText(bookmarkPath, "");
            }

            historyLog  = new LogFileHandler(historyPath);
            bookmarkLog = new LogFileHandler(bookmarkPath);

            string xpathPolicyPath = CefSharp.WinForms.Example.Properties.Settings.Default.xpathPolicyPath;

            xpathPolicy.loadAllRules(xpathPolicyPath);


            if (isDebug)
            {
                httpPolicy.proxyMode = HTTPProtocolFilter.WorkingMode.MAPPING;
                timePolicy.clearAllTo(true);
                devtoolToolStripMenuItem.Enabled = true;
                MessageBox.Show("In debug mode! Filtering is off!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                string httpPolicyPath = CefSharp.WinForms.Example.Properties.Settings.Default.httpPolicyPath;
                string timePolicyPath = CefSharp.WinForms.Example.Properties.Settings.Default.timePolicyPath;

                if (!File.Exists(httpPolicyPath))
                {
                    MessageBox.Show("Can't open http policy\n" + httpPolicyPath);
                    Process.GetCurrentProcess().Kill();
                }
                else if (!File.Exists(timePolicyPath))
                {
                    MessageBox.Show("Can't open time policy\n" + timePolicyPath);
                    Process.GetCurrentProcess().Kill();
                }

                httpPolicy.reloadPolicy(File.ReadAllText(httpPolicyPath));
                timePolicy.reloadPolicy(File.ReadAllText(timePolicyPath));
            }


            string saveFolderPath = CefSharp.WinForms.Example.Properties.Settings.Default.saveFolder;

            if (!Directory.Exists(saveFolderPath))
            {
                MessageBox.Show("Can't access save folder\n" + saveFolderPath);
                Process.GetCurrentProcess().Kill();
            }


            var bitness = Environment.Is64BitProcess ? "x64" : "x86";

            Text += " - " + bitness;

            // Read bypass secret from file:
            AddSecretHandler.BypassSecret = CefSharp.WinForms.Example.Properties.Settings.Default.bypassSecret;
        }