Beispiel #1
0
        public static void Main()
        {
            var cancellationTokenSource = new CancellationTokenSource();

            // Start the proxy.
            var tcpListener = new TcpListenerWrapper(Port, new ProxyProtocol(true));

            tcpListener.AcceptTcpClients(cancellationTokenSource.Token);

            // Disable the proxy. (To ensure that the settings are the default.)
            InternetSettings.DisableProxy();

            // Set the global proxy.
            InternetSettings.SetProxy("127.0.0.1", Port);

            // Output the proxy has started.
            Console.WriteLine($"Started the proxy on port {Port}.");
            Console.WriteLine("Press any key to stop the proxy...");

            // Wait for any key to be pressed.
            Console.ReadKey(true);

            // Cancel all active operations.
            cancellationTokenSource.Cancel();
            // Disable the proxy.
            InternetSettings.DisableProxy();
        }
Beispiel #2
0
        public FormMain()
        {
            InitializeComponent();
            application = new DownloaderApplication(this, textBoxLog);

            if (File.Exists(settingsFileName))
            {
                settings = TypeSerializer <InternetSettings> .FromXmlFile(settingsFileName);
            }
        }
Beispiel #3
0
        private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var form = new InternetSettingsForm())
            {
                form.InternetSettings = settings;
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                settings = form.InternetSettings;
            }
        }
Beispiel #4
0
        private static void PrintInternetSettings()
        {
            try
            {
                Beaprint.MainPrint("Enumerating Internet settings, zone and proxy configuration");

                var info = InternetSettings.GetInternetSettingsInfo();

                Beaprint.ColorPrint("  General Settings", Beaprint.LBLUE);
                Beaprint.NoColorPrint($"  {"Hive",-10}  {"Key",-40}  {"Value"}");

                foreach (var i in info.GeneralSettings)
                {
                    Beaprint.NoColorPrint($"  {i.Hive,-10}  {i.ValueName,-40}  {i.Value}");
                }

                Beaprint.ColorPrint("\n  Zone Maps", Beaprint.LBLUE);

                if (info.ZoneMaps.Count == 0)
                {
                    Beaprint.NoColorPrint("  No URLs configured");
                }
                else
                {
                    Beaprint.NoColorPrint($"  {"Hive",-10}  {"Value Name",-40}  {"Interpretation"}");

                    foreach (var i in info.ZoneMaps)
                    {
                        Beaprint.NoColorPrint($"  {i.Hive,-10}  {i.ValueName,-40}  {i.Interpretation}");
                    }
                }

                Beaprint.ColorPrint("\n  Zone Auth Settings", Beaprint.LBLUE);
                if (info.ZoneAuthSettings.Count == 0)
                {
                    Beaprint.NoColorPrint("  No Zone Auth Settings");
                }
                else
                {
                    foreach (var i in info.ZoneAuthSettings)
                    {
                        Beaprint.NoColorPrint($"  {i.Interpretation}");
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }