Пример #1
0
        public ProgramListControl()
        {
            InitializeComponent();

            ProgramList = new ControlList <ProgramControl, ProgramSet>(this.processScroll, (prog) => { return(new ProgramControl(prog, CatModel)); }, (prog) => prog.guid.ToString(),
                                                                       (list) => { list.Sort(DoSort); }, (item) => { return(CurFilter != null && FirewallPage.DoFilter(CurFilter, item.progSet)); });

            ProgramList.SelectionChanged += (s, e) => { SelectionChanged?.Invoke(this, e); };

            SuspendChange++;

            //this.rbbSort.Header = Translate.fmt("lbl_sort_and");
            this.lblSort.Content = Translate.fmt("lbl_sort");
            //this.chkNoLocal.Content = Translate.fmt("chk_ignore_local");
            //this.chkNoLan.Content = Translate.fmt("chk_ignore_lan");

            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_no"), Sorts.Unsorted);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_name"), Sorts.Name);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_rname"), Sorts.NameRev);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_act"), Sorts.LastActivity);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_rate"), Sorts.DataRate);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_socks"), Sorts.SocketCount);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_count"), Sorts.ModuleCount);
            WpfFunc.CmbSelect(cmbSort, ((Sorts)App.GetConfigInt("GUI", "SortList", 0)).ToString());

            this.chkNoLocal.IsChecked = App.GetConfigInt("GUI", "ActNoLocal", 0) == 1;
            this.chkNoLan.IsChecked   = App.GetConfigInt("GUI", "ActNoLan", 0) == 1;

            SuspendChange--;
        }
Пример #2
0
        /*protected ObservableCollection<ProgramSet> ProgramSets = null;
         * public ObservableCollection<ProgramSet> ItemsSource { get { return ProgramSets; } set {
         *      if(ProgramSets != null)
         *          ProgramSets.CollectionChanged -= ProgramSets_CollectionChanged;
         *      ProgramSets = value;
         *      ProgramSets.CollectionChanged += ProgramSets_CollectionChanged;
         *  } }
         *
         * private void ProgramSets_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
         * {
         * }
         */

        public ProgramListControl()
        {
            InitializeComponent();

            SelectedPrograms = new List <ProgramControl>();

            SuspendChange++;

            //this.rbbSort.Header = Translate.fmt("lbl_sort_and");
            this.lblSort.Content = Translate.fmt("lbl_sort");
            //this.chkNoLocal.Content = Translate.fmt("chk_ignore_local");
            //this.chkNoLan.Content = Translate.fmt("chk_ignore_lan");

            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_no"), Sorts.Unsorted);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_name"), Sorts.Name);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_rname"), Sorts.NameRev);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_act"), Sorts.LastActivity);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_rate"), Sorts.DataRate);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_socks"), Sorts.SocketCount);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_count"), Sorts.ModuleCount);
            WpfFunc.CmbSelect(cmbSort, ((Sorts)App.GetConfigInt("GUI", "SortList", 0)).ToString());

            this.chkNoLocal.IsChecked = App.GetConfigInt("GUI", "ActNoLocal", 0) == 1;
            this.chkNoLan.IsChecked   = App.GetConfigInt("GUI", "ActNoLan", 0) == 1;

            SuspendChange--;

            this.processScroll.PreviewKeyDown += process_KeyEventHandler;
        }
Пример #3
0
        public NetworkSocketList()
        {
            InitializeComponent();

            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_all"), FirewallPage.FilterPreset.Socket.Any);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_web"), FirewallPage.FilterPreset.Socket.Web).Background       = new SolidColorBrush(Colors.DodgerBlue);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_tcp"), FirewallPage.FilterPreset.Socket.TCP).Background       = new SolidColorBrush(Colors.Turquoise);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_client"), FirewallPage.FilterPreset.Socket.Client).Background = new SolidColorBrush(Colors.Gold);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_server"), FirewallPage.FilterPreset.Socket.Server).Background = new SolidColorBrush(Colors.DarkOrange);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_udp"), FirewallPage.FilterPreset.Socket.UDP).Background       = new SolidColorBrush(Colors.Violet);
            //WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_raw"), FirewallPage.FilterPreset.Socket.Raw);

            this.txtSockFilter.LabelText = Translate.fmt("lbl_text_filter");
            //this.chkNoINet.ToolTip = Translate.fmt("str_no_inet");
            //this.chkNoLAN.ToolTip = Translate.fmt("str_no_lan");
            //this.chkNoMulti.ToolTip = Translate.fmt("str_no_multi");
            //this.chkNoLocal.ToolTip = Translate.fmt("str_no_local");

            this.socksGrid.Columns[1].Header  = Translate.fmt("lbl_name");
            this.socksGrid.Columns[2].Header  = Translate.fmt("lbl_time_stamp");
            this.socksGrid.Columns[3].Header  = Translate.fmt("lbl_state");
            this.socksGrid.Columns[4].Header  = Translate.fmt("lbl_protocol");
            this.socksGrid.Columns[5].Header  = Translate.fmt("lbl_remote_ip");
            this.socksGrid.Columns[6].Header  = Translate.fmt("lbl_remote_port");
            this.socksGrid.Columns[7].Header  = Translate.fmt("lbl_local_ip");
            this.socksGrid.Columns[8].Header  = Translate.fmt("lbl_local_port");
            this.socksGrid.Columns[9].Header  = Translate.fmt("lbl_access");
            this.socksGrid.Columns[10].Header = Translate.fmt("lbl_upload");
            this.socksGrid.Columns[11].Header = Translate.fmt("lbl_download");
            this.socksGrid.Columns[12].Header = Translate.fmt("lbl_uploaded");
            this.socksGrid.Columns[13].Header = Translate.fmt("lbl_downloaded");
            this.socksGrid.Columns[14].Header = Translate.fmt("lbl_program");

            socksGridExt = new DataGridExt(socksGrid);
            socksGridExt.Restore(App.GetConfig("GUI", "socksGrid_Columns", ""));

            SocketList            = new ObservableCollection <SocketItem>();
            socksGrid.ItemsSource = SocketList;

            UwpFunc.AddBinding(socksGrid, new KeyGesture(Key.F, ModifierKeys.Control), (s, e) => { this.txtSockFilter.Focus(); });
            //UwpFunc.AddBinding(socksGrid, new KeyGesture(Key.Delete), btnRemoveRule_Click);

            try
            {
                textFilter         = App.GetConfig("NetSocks", "Filter", "");
                txtSockFilter.Text = textFilter;
                WpfFunc.CmbSelect(sockType, ((FirewallPage.FilterPreset.Socket)App.GetConfigInt("NetSocks", "Types", 0)).ToString());

                //this.chkNoLocal.IsChecked = App.GetConfigInt("NetSocks", "NoLocal", 0) == 1;
                //this.chkNoMulti.IsChecked = App.GetConfigInt("NetSocks", "NoMulti", 0) == 1;
                //this.chkNoLAN.IsChecked = App.GetConfigInt("NetSocks", "NoLan", 0) == 1;
                //this.chkNoINet.IsChecked = App.GetConfigInt("NetSocks", "NoINet", 0) == 1;
            }
            catch { }

            CheckSockets();
        }
Пример #4
0
        public SettingsPage()
        {
            InitializeComponent();

            this.lblStartup.Text      = Translate.fmt("lbl_startup_options");
            this.chkTray.Content      = Translate.fmt("chk_show_tray");
            this.chkAutoStart.Content = Translate.fmt("chk_autorun");
            this.chkService.Content   = Translate.fmt("chk_instal_svc");
            this.chkNoUAC.Content     = Translate.fmt("chk_no_uac");

            this.lblPrivacy.Text       = Translate.fmt("lbl_tweak_guard");
            this.chkTweakCheck.Content = Translate.fmt("chk_tweak_check");
            this.chkTweakFix.Content   = Translate.fmt("chk_tweak_fix");

            this.lblFirewall.Text    = Translate.fmt("lbl_firewall_options");
            this.chkUseFW.Content    = Translate.fmt("chk_manage_fw");
            this.chkNotifyFW.Content = Translate.fmt("chk_show_notify");

            this.chkGuardFW.Content = Translate.fmt("chk_fw_guard");
            //this.chkFixRules.Content = Translate.fmt("chk_fix_rules");
            this.radAlert.Content   = Translate.fmt("chk_fw_guard_alert");
            this.radDisable.Content = Translate.fmt("chk_fw_guard_disable");
            this.radFix.Content     = Translate.fmt("chk_fw_guard_fix");

            this.lblMode.Content      = Translate.fmt("lbl_filter_mode");
            this.radWhitelist.Content = Translate.fmt("chk_fw_whitelist");
            this.radBlacklist.Content = Translate.fmt("chk_fw_blacklist");
            this.radDisabled.Content  = Translate.fmt("chk_fw_disable");
            this.lblAudit.Content     = Translate.fmt("chk_audit_policy");

            this.lblAuditAll.Content   = Translate.fmt("lbl_audit_all");
            this.lblAuditBlock.Content = Translate.fmt("lbl_audit_blocked");
            this.lblAuditNone.Content  = Translate.fmt("lbl_audit_off");

            this.chkDnsInspector.Content = Translate.fmt("lbl_use_inspector");
            this.chkReverseDNS.Content   = Translate.fmt("lbl_use_rev_dns");
            this.lblDNS.Text             = Translate.fmt("lbl_dns_proxy");
            this.chkEnableDNS.Content    = Translate.fmt("lbl_use_dns_proxy");
            this.chkLocalDNS.Content     = Translate.fmt("lbl_setup_dns");
            this.lblRootDNS.Content      = Translate.fmt("lbl_dns_root");

            WpfFunc.CmbAdd(this.cmbRootDNS, "Google", "8.8.8.8|8.8.4.4");
            WpfFunc.CmbAdd(this.cmbRootDNS, "OpenDNS", "208.67.222.222|208.67.220.220");
            WpfFunc.CmbAdd(this.cmbRootDNS, "Level3", "209.244.0.3|209.244.0.4");
            WpfFunc.CmbAdd(this.cmbRootDNS, "DNS.WATCH", "84.200.69.80|84.200.70.40");
            WpfFunc.CmbAdd(this.cmbRootDNS, "Cloudflare", "1.1.1.1|1.0.0.1");

            Refresh();

            App.client.SettingsChangedNotification += Client_SettingsChangedNotification;;
        }
Пример #5
0
        public FirewallLogList()
        {
            InitializeComponent();

            //this.grpLog.Header = Translate.fmt("gtp_con_log");

            /*this.grpLogTools.Header = Translate.fmt("grp_tools");
             * this.grpLogView.Header = Translate.fmt("grp_view");
             *
             * this.btnMkRule.Content = Translate.fmt("btn_mk_rule");
             * this.btnClearLog.Content = Translate.fmt("btn_clear_log");
             * this.lblShowCons.Content = Translate.fmt("lbl_show_cons");
             * this.chkNoLocal.Content = Translate.fmt("chk_hide_local");
             * this.chkNoLAN.Content = Translate.fmt("chk_hide_lan");
             * this.lblFilterCons.Content = Translate.fmt("lbl_filter_cons");*/

            this.txtConFilter.LabelText = Translate.fmt("lbl_text_filter");
            this.cmbAll.Content         = Translate.fmt("str_all_events");
            this.cmbAllow.Content       = Translate.fmt("str_allowed");
            this.cmbBlock.Content       = Translate.fmt("str_blocked");
            this.chkNoINet.ToolTip      = Translate.fmt("str_no_inet");
            this.chkNoLAN.ToolTip       = Translate.fmt("str_no_lan");
            this.chkNoMulti.ToolTip     = Translate.fmt("str_no_multi");
            this.chkNoLocal.ToolTip     = Translate.fmt("str_no_local");

            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_protocols_any"), FirewallPage.FilterPreset.Socket.Any);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_web"), FirewallPage.FilterPreset.Socket.Web).Background       = new SolidColorBrush(Colors.DodgerBlue);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_tcp"), FirewallPage.FilterPreset.Socket.TCP).Background       = new SolidColorBrush(Colors.Turquoise);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_client"), FirewallPage.FilterPreset.Socket.Client).Background = new SolidColorBrush(Colors.Gold);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_server"), FirewallPage.FilterPreset.Socket.Server).Background = new SolidColorBrush(Colors.DarkOrange);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_sockets_udp"), FirewallPage.FilterPreset.Socket.UDP).Background       = new SolidColorBrush(Colors.Violet);
            WpfFunc.CmbAdd(sockType, Translate.fmt("filter_protocols_other"), FirewallPage.FilterPreset.Socket.Other).Background = new SolidColorBrush(Colors.LightGray);

            int i = 0;

            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_name");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_time_stamp");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_action");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_direction");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_protocol");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_remote_ip");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_remote_port");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_local_ip");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_local_port");
            this.logGrid.Columns[++i].Header = Translate.fmt("lbl_program");

            LogList             = new ObservableCollection <LogItem>();
            logGrid.ItemsSource = LogList;

            logGridExt = new DataGridExt(logGrid);
            logGridExt.Restore(App.GetConfig("FwLog", "Columns", ""));


            UwpFunc.AddBinding(logGrid, new KeyGesture(Key.F, ModifierKeys.Control), (s, e) => { this.txtConFilter.Focus(); });

            try
            {
                textFilter                = App.GetConfig("FwLog", "Filter", "");
                txtConFilter.Text         = textFilter;
                cmbConTypes.SelectedIndex = App.GetConfigInt("FwLog", "Events", 0);

                WpfFunc.CmbSelect(sockType, ((FirewallPage.FilterPreset.Socket)App.GetConfigInt("FwLog", "Types", 0)).ToString());

                //this.chkAllowed.IsChecked = App.GetConfigInt("FwLog", "ShowAllowed", 1) == 1;
                //this.chkBlocked.IsChecked = App.GetConfigInt("FwLog", "ShowBlocked", 1) == 1;
                this.chkNoLocal.IsChecked = App.GetConfigInt("FwLog", "NoLocal", 0) == 1;
                this.chkNoMulti.IsChecked = App.GetConfigInt("FwLog", "NoMulti", 0) == 1;
                this.chkNoLAN.IsChecked   = App.GetConfigInt("FwLog", "NoLan", 0) == 1;
                this.chkNoINet.IsChecked  = App.GetConfigInt("FwLog", "NoINet", 0) == 1;
            }
            catch { }

            //mConLimit = App.engine.programs.MaxLogLength * 10; // todo
            logLimit = App.GetConfigInt("GUI", "LogLimit", 1000);

            CheckLogLines();
        }